(urlString: string)
| 70 | } |
| 71 | |
| 72 | public async showViewer(urlString: string): Promise<void> { |
| 73 | const url = new URL(urlString); |
| 74 | const host = url.host; |
| 75 | const token = url.searchParams.get('token') || undefined; |
| 76 | const ind = this.viewers.findIndex( |
| 77 | (viewer) => viewer.host === host |
| 78 | ); |
| 79 | if (ind >= 0) { |
| 80 | const viewer = this.viewers.splice(ind, 1)[0]; |
| 81 | this.viewers.unshift(viewer); |
| 82 | viewer.show(); |
| 83 | } else { |
| 84 | const conf = config(); |
| 85 | const colorTheme = conf.get('plot.defaults.colorTheme', 'vscode'); |
| 86 | this.viewerOptions.stripStyles = (colorTheme === 'vscode'); |
| 87 | this.viewerOptions.previewPlotLayout = conf.get<PreviewPlotLayout>('plot.defaults.plotPreviewLayout', 'multirow'); |
| 88 | this.viewerOptions.refreshTimeoutLength = conf.get('plot.timing.refreshInterval', 10); |
| 89 | this.viewerOptions.resizeTimeoutLength = conf.get('plot.timing.resizeInterval', 100); |
| 90 | this.viewerOptions.fullWindow = conf.get('plot.defaults.fullWindowMode', false); |
| 91 | this.viewerOptions.token = token; |
| 92 | const viewer = new HttpgdViewer(host, this.viewerOptions); |
| 93 | if (isHost() && autoShareBrowser) { |
| 94 | const disposable = await shareServer(url, 'httpgd'); |
| 95 | viewer.webviewPanel?.onDidDispose(() => void disposable.dispose()); |
| 96 | } |
| 97 | this.viewers.unshift(viewer); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | public registerActiveViewer(viewer: HttpgdViewer): void { |
| 102 | const ind = this.recentlyActiveViewers.indexOf(viewer); |
no test coverage detected