web - best lifecycle support we can do currently

This commit is contained in:
Benjamin Pasero
2019-06-18 15:12:41 +02:00
parent 4118892ac5
commit 998a65e2ca
10 changed files with 91 additions and 67 deletions

View File

@@ -75,7 +75,8 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
}));
this._register(lifecycleService.onBeforeShutdown(e => {
e.veto(this._onBeforeShutdown());
this._onBeforeShutdown();
e.veto(false); // Don't veto shutdown
}, this));
}
@@ -217,13 +218,12 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
return `mainThreadWebview-${viewType}`;
}
private _onBeforeShutdown(): boolean {
private _onBeforeShutdown(): void {
this._webviews.forEach((webview) => {
if (!webview.isDisposed() && webview.state && this._revivers.has(webview.state.viewType)) {
webview.state.state = webview.webviewState;
}
});
return false; // Don't veto shutdown
}
private createWebviewEventDelegate(handle: WebviewPanelHandle) {