return task;
},
- destroyTask: function (createTimestamp: string) {
- const task = this.getTask(createTimestamp);
- if (task) {
- task.parentElement!.removeChild(task);
- }
- },
-
getPriority: function (task: Element): number {
if (task.hasAttribute("data-priority")) {
return parseFloat(task.getAttribute("data-priority")!);
if (command == "Create") {
return Model.addTask(timestamp, data);
}
- if (command == "Destroy") {
- return Model.destroyTask(data.split(" ", 1)[0]);
- }
if (command == "State") {
const [createTimestamp, state] = splitN(data, " ", 1);
return Model.setState(timestamp, createTimestamp, state);
addTask: function (description: string): Element {
return <Element>log.recordAndApply(`${Date.now()} Create ${description}`);
},
- destroyTask: function (createTimestamp: string) {
- return log.recordAndApply(`${Date.now()} Destroy ${createTimestamp} ${Model.getTask(createTimestamp)?.textContent}`);
- },
setPriority: function (createTimestamp: string, priority: number) {
return log.recordAndApply(`${Date.now()} Priority ${createTimestamp} ${priority}`);
},
if (event.key == "w") return BrowserUI.setState("waiting");
if (event.key == "d") return BrowserUI.setState("done");
if (event.key == "c") return BrowserUI.setState("cancelled");
- if (event.key == "X") return BrowserUI.destroyTask();
+ if (event.key == "X") return BrowserUI.setState("deleted");
}
}