workbench.web.api.ts 2.3 KB
Newer Older
B
Benjamin Pasero 已提交
1 2 3 4 5 6 7 8
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import 'vs/workbench/workbench.web.main';
import { main } from 'vs/workbench/browser/web.main';
import { UriComponents } from 'vs/base/common/uri';
S
Sandeep Somavarapu 已提交
9
import { IFileSystemProvider } from 'vs/platform/files/common/files';
10
import { IRequestOptions, IRequestContext } from 'vs/platform/request/common/request';
A
Alex Dima 已提交
11
import { IWebSocketFactory } from 'vs/platform/remote/browser/browserSocketFactory';
B
Benjamin Pasero 已提交
12 13

export interface IWorkbenchConstructionOptions {
B
Benjamin Pasero 已提交
14 15 16 17 18

	/**
	 * Experimental: the remote authority is the IP:PORT from where the workbench is served
	 * from. It is for example being used for the websocket connections as address.
	 */
B
Benjamin Pasero 已提交
19 20
	remoteAuthority: string;

B
Benjamin Pasero 已提交
21 22 23 24
	/**
	 * Experimental: An endpoint to serve iframe content ("webview") from. This is required
	 * to provide full security isolation from the workbench host.
	 */
B
Benjamin Pasero 已提交
25 26
	webviewEndpoint?: string;

B
Benjamin Pasero 已提交
27 28 29
	/**
	 * Experimental: An optional folder that is set as workspace context for the workbench.
	 */
B
Benjamin Pasero 已提交
30
	folderUri?: UriComponents;
B
Benjamin Pasero 已提交
31 32 33 34

	/**
	 * Experimental: An optional workspace that is set as workspace context for the workbench.
	 */
B
Benjamin Pasero 已提交
35
	workspaceUri?: UriComponents;
36

B
Benjamin Pasero 已提交
37 38 39 40
	/**
	 * Experimental: The userDataProvider is used to handle user specific application
	 * state like settings, keybindings, UI state (e.g. opened editors) and snippets.
	 */
S
Sandeep Somavarapu 已提交
41
	userDataProvider?: IFileSystemProvider;
42 43 44 45 46 47

	/**
	 * Experimental: Optional request handler to handle http requests.
	 * In case not provided, workbench uses <code>XMLHttpRequest</code>.
	 */
	requestHandler?: (requestOptions: IRequestOptions) => Promise<IRequestContext>;
A
Alex Dima 已提交
48 49 50 51 52

	/**
	 * A factory for web sockets.
	 */
	webSocketFactory?: IWebSocketFactory;
B
Benjamin Pasero 已提交
53 54
}

B
Benjamin Pasero 已提交
55 56 57 58 59 60
/**
 * Experimental: Creates the workbench with the provided options in the provided container.
 *
 * @param domElement the container to create the workbench in
 * @param options for setting up the workbench
 */
B
Benjamin Pasero 已提交
61 62 63 64
function create(domElement: HTMLElement, options: IWorkbenchConstructionOptions): Promise<void> {
	return main(domElement, options);
}

B
Benjamin Pasero 已提交
65 66
export {
	create
B
Benjamin Pasero 已提交
67
};