Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private handleActions(): void {
// listen for open prefs
this.subToShowPagePrefs = this.actions$.pipe(ofAction(ShowPagePrefs))
.subscribe(() => this.openView.emit());
// clean up on a reset
this.subToReset = this.actions$.pipe(ofAction(Reset))
.subscribe(() => this.store.dispatch(new ClearPaths()));
// cancel long-running operation
this.subToCancel = this.actions$.pipe(ofAction(Canceled))
.subscribe(() => {
this.zone.run(() => {
this.store.dispatch(new Progress({ state: 'completed' }));
this.s3Svc.cancelUpload();
});
});
}
private handleActions(): void {
// listen for open prefs
this.subToShowPagePrefs = this.actions$.pipe(ofAction(ShowPagePrefs))
.subscribe(() => this.openView.emit());
// clean up on a reset
this.subToReset = this.actions$.pipe(ofAction(Reset))
.subscribe(() => this.store.dispatch(new ClearPaths()));
// cancel long-running operation
this.subToCancel = this.actions$.pipe(ofAction(Canceled))
.subscribe(() => {
this.zone.run(() => {
this.store.dispatch(new Progress({ state: 'completed' }));
this.s3Svc.cancelUpload();
});
});
}
private handleActions(): void {
// listen for open prefs
this.subToShowPagePrefs = this.actions$.pipe(ofAction(ShowPagePrefs))
.subscribe(() => this.openView.emit());
// clean up on a reset
this.subToReset = this.actions$.pipe(ofAction(Reset))
.subscribe(() => this.store.dispatch(new ClearPaths()));
// cancel long-running operation
this.subToCancel = this.actions$.pipe(ofAction(Canceled))
.subscribe(() => {
this.zone.run(() => {
this.store.dispatch(new Progress({ state: 'completed' }));
this.s3Svc.cancelUpload();
});
});
}
private handleActions(): void {
// listen for open prefs
this.subToShowPagePrefs = this.actions$.pipe(ofAction(ShowPagePrefs))
.subscribe(() => this.openView.emit());
}
private handleActions(): void {
// handle general Cancel in case of long running main process action
this.subToCancel = this.actions$.pipe(ofAction(Canceled))
.subscribe(() => this.electron.ipcRenderer.send('cancel'));
}
ngxsOnInit({ dispatch }: StateContext) {
this.actions$
.pipe(ofAction(DirLoaded, DirUnloaded))
.subscribe(() => dispatch(new ValidateClipboard));
}
private handleDirUnloaded({ dispatch, getState }: StateContext): void {
this.actions$
.pipe(ofAction(DirUnloaded))
.subscribe(({ path }) => {
const layout = getState();
LayoutState.visitTabs(layout, (tab: Tab) => {
const ix = tab.paths.indexOf(path);
if (ix !== -1)
dispatch(new RemovePathFromTab({ path, tab }));
});
});
}