nuclo 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,12 +102,12 @@ type Todo = { id: number; text: string; done: boolean };
|
|
|
102
102
|
|
|
103
103
|
let todos: Todo[] = [];
|
|
104
104
|
let nextId = 1;
|
|
105
|
-
let
|
|
105
|
+
let inputValue = '';
|
|
106
106
|
|
|
107
107
|
function addTodo() {
|
|
108
|
-
if (!
|
|
109
|
-
todos.push({ id: nextId++, text:
|
|
110
|
-
|
|
108
|
+
if (!inputValue.trim()) return;
|
|
109
|
+
todos.push({ id: nextId++, text: inputValue, done: false });
|
|
110
|
+
inputValue = '';
|
|
111
111
|
update();
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -116,8 +116,8 @@ const app = div(
|
|
|
116
116
|
|
|
117
117
|
// Input
|
|
118
118
|
div(
|
|
119
|
-
input({ value: () =>
|
|
120
|
-
on('input', e => {
|
|
119
|
+
input({ value: () => inputValue },
|
|
120
|
+
on('input', e => { inputValue = e.target.value; update(); }),
|
|
121
121
|
on('keydown', e => e.key === 'Enter' && addTodo())
|
|
122
122
|
),
|
|
123
123
|
button('Add', on('click', addTodo))
|