This repository has been archived on 2024-09-09 . You can view files and clone it, but cannot push or open issues or pull requests.
0b072e771e
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
* Licensed under the MIT License. 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 = new SimpleBrowserView(this.extensionUri, url, options);
|
|||
view.onDispose(() => {
|
|||
if (this._activeView === view) {
|
|||
this._activeView = undefined;
|
|||
}
|
|||
});
|
|||
|
|||
this._activeView = view;
|
|||
}
|
|||
}
|
|||
}
|
|||
|
|||
|