-var tasks: string[] = [];
-
-function createViewTask(task: string) {
- const viewTask = document.createElement("div");
- viewTask.appendChild(document.createTextNode(task));
- viewTask.setAttribute("tabindex", "0");
- return viewTask;
-}
-
-function updateView() {
- tasks.forEach((t) => document.getElementById(t) || document.body.appendChild(createViewTask(t)));
+function createTask(description: string) {
+ const task = document.createElement("div");
+ task.appendChild(document.createTextNode(description));
+ task.setAttribute("tabindex", "0");
+ return task;
}
-function addTask(task: string) {
- tasks.push(task);
- updateView();
+function addTask(description: string) {
+ document.body.appendChild(createTask(description));
}
function browserCreateTask(form: any) {