Skip to content

Instantly share code, notes, and snippets.

@pusewicz
Last active September 12, 2022 14:10
Show Gist options
  • Save pusewicz/2b24f67e9e41a5d9e4d9305e166bf24e to your computer and use it in GitHub Desktop.
Save pusewicz/2b24f67e9e41a5d9e4d9305e166bf24e to your computer and use it in GitHub Desktop.
Bonus point: Dynamic update
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