1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-21 21:25:25 +02:00

refactor for pure functional business logic

This commit is contained in:
Morris Brodersen
2023-11-30 11:42:02 +01:00
parent 2815a1eb4c
commit dd8dc8c4af
15 changed files with 449 additions and 252 deletions

View File

@@ -82,7 +82,7 @@ export function TodoCustomList(el) {
}
el.dispatchEvent(
new CustomEvent('deleteTodoList', {
new CustomEvent('deleteCustomTodoList', {
detail: list,
bubbles: true,
}),
@@ -115,15 +115,15 @@ export function TodoCustomList(el) {
e.detail.index = e.detail.index ?? 0;
});
el.addEventListener('todoCustomList', (e) => {
el.addEventListener('customTodoList', (e) => {
list = e.detail;
update();
});
function save() {
el.dispatchEvent(
new CustomEvent('saveTodoList', {
detail: { list, title: inputEl.value.trim() },
new CustomEvent('editCustomTodoList', {
detail: { ...list, title: inputEl.value.trim() },
bubbles: true,
}),
);