This file contains hidden or 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
| const Task = class { | |
| constructor() { | |
| this._list = []; | |
| } | |
| add(task) { | |
| this._list.push(task); | |
| } | |
| remove(task) { |
This file contains hidden or 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
| const Task = class { | |
| constructor() { | |
| this._list = []; | |
| } | |
| add(task) { | |
| if (!(task instanceof Task)) throw 'invalid Task'; | |
| this._list.push(task); | |
| } |
This file contains hidden or 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
| const Task = class { | |
| constructor() { | |
| this._list = []; | |
| } | |
| add(task) { | |
| if (!(task instanceof Task)) throw 'invalid Task'; | |
| this._list.push(task); | |
| } |
This file contains hidden or 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
| const Task = class { | |
| constructor(title, date) { | |
| if (!title) throw 'invalid title'; | |
| this._title = title; | |
| this._date = date; | |
| this._isComplete = false; | |
| this._list = []; | |
| } |
This file contains hidden or 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
| const Task = class { | |
| constructor(title, date) { | |
| if (!title) throw 'invalid title'; | |
| this._title = title; | |
| this._date = date; | |
| this._isComplete = false; | |
| } | |
| isComplete() { |
This file contains hidden or 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
| <html><head></head><body> | |
| <section id="todo"></section> | |
| <script> | |
| const TaskState = class { | |
| static addState(key, cls) { | |
| const v = new cls(); | |
| if (!(v instanceof TaskState)) throw 'invalid cls'; | |
| if ((TaskState._subClasses || (TaskState._subClasses = new Map())).has(key)) throw 'exist key'; | |
| TaskState._subClasses.set(key, cls); | |
| } |
This file contains hidden or 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
| <html><head></head><body> | |
| <section id="todo"></section> | |
| <script> | |
| const TaskState = class { | |
| static addState(key, cls) { | |
| const v = new cls(); | |
| if (!(v instanceof TaskState)) throw 'invalid cls'; | |
| if ((TaskState._subClasses || (TaskState._subClasses = new Map())).has(key)) throw 'exist key'; | |
| TaskState._subClasses.set(key, cls); | |
| } |
This file contains hidden or 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
| <html><head></head><body> | |
| <section id="todo"></section> | |
| <script> | |
| const TaskState = class { | |
| static addState(key, cls) { | |
| const v = new cls(); | |
| if (!(v instanceof TaskState)) throw 'invalid cls'; | |
| if ((TaskState._subClasses || (TaskState._subClasses = new Map())).has(key)) throw 'exist key'; | |
| TaskState._subClasses.set(key, cls); | |
| } |
This file contains hidden or 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
| <html><head></head><body> | |
| <section id="todo"></section> | |
| <script> | |
| const Listener = class { | |
| listen(type) { | |
| throw 'must be overrided'; | |
| } | |
| }; | |
| const Task = class extends Listener { | |
| constructor() { |
This file contains hidden or 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
| <html><head></head><body> | |
| <section id="todo"></section> | |
| <script> | |
| const Task = class { | |
| constructor() { | |
| this._list = []; | |
| } | |
| add(task) { | |
| this._list.push(task); | |
| } |