mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 09:39:15 +00:00
Switch to an event-based architecture
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user