Skip to content

Commit

Permalink
examples: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyfrc committed Nov 19, 2023
1 parent d69537f commit 59afcd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions examples/003_todo.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ <h1>Todo List</h1>
todoStore.use(loggingMiddleware);

class TodoListElement extends ReactiveElement {
todos = this.subscribe(todoStore, 'todos');
store = todoStore;
todos = this.subscribe(this.store, 'todos');

constructor() {
super();
Expand All @@ -54,14 +55,14 @@ <h1>Todo List</h1>
<input id="newTodo" type="text" />
<button @click=${() => {
const newTodo = document.getElementById('newTodo').value;
this.dispatch("add", newTodo);
this.store.dispatch("add", newTodo);
document.getElementById('newTodo').value = '';
}}>Add</button>
<ul>
${this.todos.map(todo => html`
<li>
${todo}
<button @click=${() => this.dispatch("delete", todo)}>Delete</button>
<button @click=${() => this.store.dispatch("delete", todo)}>Delete</button>
</li>
`)}
</ul>
Expand Down
7 changes: 4 additions & 3 deletions examples/partials/_003_todo.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ <h1>Todo List</h1>
todoStore.use(loggingMiddleware);

class TodoListElement extends ReactiveElement {
todos = this.subscribe(todoStore, 'todos');
store = todoStore;
todos = this.subscribe(this.store, 'todos');

constructor() {
super();
Expand All @@ -45,14 +46,14 @@ <h1>Todo List</h1>
<input id="newTodo" type="text" />
<button @click=${() => {
const newTodo = document.getElementById('newTodo').value;
this.dispatch("add", newTodo);
this.store.dispatch("add", newTodo);
document.getElementById('newTodo').value = '';
}}>Add</button>
<ul>
${this.todos.map(todo => html`
<li>
${todo}
<button @click=${() => this.dispatch("delete", todo)}>Delete</button>
<button @click=${() => this.store.dispatch("delete", todo)}>Delete</button>
</li>
`)}
</ul>
Expand Down

0 comments on commit 59afcd1

Please sign in to comment.