Last active
September 12, 2022 14:10
-
-
Save pusewicz/2b24f67e9e41a5d9e4d9305e166bf24e to your computer and use it in GitHub Desktop.
Bonus point: Dynamic update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addTodo(e) { | |
const value = e.target.value.trim() | |
if (!value) { | |
return | |
} | |
const todo = { | |
id: Date.now(), | |
title: value, | |
completed: false | |
} | |
this.todos.push(todo) | |
e.target.value = '' | |
+ setTimeout(() => { | |
+ const event = new CustomEvent("harvest-event:timers:add", { | |
+ detail: { element: document.getElementById(todo.id) } | |
+ }); | |
+ document.querySelector("#harvest-messaging").dispatchEvent(event); | |
+ }, 100) | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment