Switch to an event-based architecture

This commit is contained in:
Surma
2018-12-17 16:40:29 +00:00
parent bfe74b5fb2
commit 672c57b61f
3 changed files with 94 additions and 23 deletions

View File

@@ -73,6 +73,11 @@ export default class App extends Component<Props, State> {
import('./client-api').then(m => m.exposeAPI(this));
}
@bind openFile(file: File | Fileish) {
this.openEditor();
this.setState({ file });
}
@bind
private onFileDrop({ files }: FileDropEvent) {
if (!files || files.length === 0) return;
@@ -83,8 +88,7 @@ export default class App extends Component<Props, State> {
@bind
private onIntroPickFile(file: File | Fileish) {
this.openEditor();
this.setState({ file });
return this.openFile(file);
}
@bind