}
const Model = {
+ addTask: function (timestamp: string, description: string) {
+ document.body.appendChild(this.createTask(timestamp, description)).focus();
+ },
+
createTask: function (timestamp: string, description: string) {
const task = document.createElement("div");
task.appendChild(document.createTextNode(description));
return task;
},
- addTask: function (timestamp: string, description: string) {
- document.body.appendChild(this.createTask(timestamp, description)).focus();
+ destroyTask: function (createTimestamp: string) {
+ const task = this.getTask(createTimestamp);
+ if (task) {
+ task.parentElement!.removeChild(task);
+ }
},
getTask: function (createTimestamp: string) {
}
},
- destroyTask: function (createTimestamp: string) {
- const task = this.getTask(createTimestamp);
- if (task) {
- task.parentElement!.removeChild(task);
- }
- },
-
setState: function (stateTimestamp: string, createTimestamp: string, state: string) {
const task = this.getTask(createTimestamp);
if (task) {