}
const Model = {
- createTask: function (description: string) {
+ createTask: function (timestamp: string, description: string) {
const task = document.createElement("div");
task.appendChild(document.createTextNode(description));
task.setAttribute("tabindex", "0");
+ task.setAttribute("data-created", timestamp);
return task;
},
- addTask: function (description: string) {
- document.body.appendChild(this.createTask(description)).focus();
+ addTask: function (timestamp: string, description: string) {
+ document.body.appendChild(this.createTask(timestamp, description)).focus();
},
moveCursor: function (offset: number) {
apply: function (entry: string) {
const [timestamp, command, data] = splitN(entry, " ", 2);
if (command == "Create") {
- Model.addTask(data);
+ Model.addTask(timestamp, data);
}
},