mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 09:35:37 -05:00
* Build breaks 1 * Build breaks * Build breaks * Build breaks * More build breaks * Build breaks (#2512) * Runtime breaks * Build breaks * Fix dialog location break * Update typescript * Fix ASAR break issue * Unit test breaks * Update distro * Fix breaks in ADO builds (#2513) * Bump to node 16 * Fix hygiene errors * Bump distro * Remove reference to node type * Delete vscode specific extension * Bump to node 16 in CI yaml * Skip integration tests in CI builds (while fixing) * yarn.lock update * Bump moment dependency in remote yarn * Fix drop-down chevron style * Bump to node 16 * Remove playwrite from ci.yaml * Skip building build scripts in hygine check
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as vscode from 'vscode';
|
|
import { ShowOptions, SimpleBrowserView } from './simpleBrowserView';
|
|
|
|
export class SimpleBrowserManager {
|
|
|
|
private _activeView?: SimpleBrowserView;
|
|
|
|
constructor(
|
|
private readonly extensionUri: vscode.Uri,
|
|
) { }
|
|
|
|
dispose() {
|
|
this._activeView?.dispose();
|
|
this._activeView = undefined;
|
|
}
|
|
|
|
public show(url: string, options?: ShowOptions): void {
|
|
if (this._activeView) {
|
|
this._activeView.show(url, options);
|
|
} else {
|
|
const view = SimpleBrowserView.create(this.extensionUri, url, options);
|
|
this.registerWebviewListeners(view);
|
|
|
|
this._activeView = view;
|
|
}
|
|
}
|
|
|
|
public restore(panel: vscode.WebviewPanel, state: any): void {
|
|
const url = state?.url ?? '';
|
|
const view = SimpleBrowserView.restore(this.extensionUri, url, panel);
|
|
this.registerWebviewListeners(view);
|
|
return;
|
|
}
|
|
|
|
private registerWebviewListeners(view: SimpleBrowserView) {
|
|
view.onDispose(() => {
|
|
if (this._activeView === view) {
|
|
this._activeView = undefined;
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
|