Created
May 28, 2019 17:55
-
-
Save artberri/9417b6403b747038fc2f8981c0fc42e6 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 { Type, Injector } from '../framework'; | |
import { ITodoUserActions } from './todo.view'; | |
import { TodoPresenter } from '../presenters'; | |
// tslint:disable-next-line:typedef | |
export function TodoMixin<TBase extends Type>(base: TBase) { | |
return class extends base implements ITodoUserActions { | |
public presenter: TodoPresenter = Injector.resolve(TodoPresenter); | |
public onDoubleClicked(): void { | |
this.presenter.setEditMode(); | |
} | |
public onToggleCheckboxClicked(): void { | |
this.presenter.toggleTodo(); | |
} | |
public onRemoveButtonClicked(): void { | |
this.presenter.removeTodo(); | |
} | |
public onInputBlur(inputContent: string): void { | |
this.presenter.editTodo(inputContent); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment