In the spirit of maintaining the invariant: all tasks are in the DOM; no
loose, floating tasks.
const Model = {
addTask: function (timestamp: string, description: string) {
const Model = {
addTask: function (timestamp: string, description: string) {
- document.getElementById("tasks")!.appendChild(this.createTask(timestamp, description)).focus();
- },
-
- createTask: function (timestamp: string, description: string) {
const task = document.createElement("div");
task.appendChild(document.createTextNode(description));
task.setAttribute("class", "task");
task.setAttribute("tabindex", "0");
task.setAttribute("data-created", timestamp);
const task = document.createElement("div");
task.appendChild(document.createTextNode(description));
task.setAttribute("class", "task");
task.setAttribute("tabindex", "0");
task.setAttribute("data-created", timestamp);
+ document.getElementById("tasks")!.appendChild(task);
+ task.focus();
},
destroyTask: function (createTimestamp: string) {
},
destroyTask: function (createTimestamp: string) {