Created
May 30, 2019 21:37
-
-
Save nanotroy/264b8de55d69fa708ba4611c30145e93 to your computer and use it in GitHub Desktop.
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
import { StreamBox } from '@crui/reactive/rx/box'; | |
export type Todo = { | |
text: string, | |
} | |
export type TodoList = Todo[] | |
export class TodoStore { | |
public readonly input: StreamBox<string> | |
public readonly todos: TodoList | |
constructor() { | |
this.input = new StreamBox('') | |
this.todos = [] | |
} | |
addTodo(todo: string): void { | |
this.todos.push({ | |
text: todo, | |
}) | |
} | |
dispose() { | |
this.input.destroy() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment