Archived
1
0
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.
code-server/lib/vscode/extensions/simple-browser/src/simpleBrowserManager.ts
Joe Previte eae5d8c807
chore(vscode): update to 1.53.2
These conflicts will be resolved in the following commits. We do it this way so
that PR review is possible.
2021-02-25 11:27:27 -07:00

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;
}
}
}