web - change API to URI (from UriComponents)

This commit is contained in:
Benjamin Pasero
2019-09-17 07:43:53 +02:00
parent bdd1971f2c
commit 08a5964645
8 changed files with 29 additions and 21 deletions

View File

@@ -113,8 +113,8 @@ class PollingURLCallbackProvider extends Disposable implements IURLCallbackProvi
FRAGMENT: 'vscode-fragment'
};
private readonly _onCallback: Emitter<UriComponents> = this._register(new Emitter<UriComponents>());
readonly onCallback: Event<UriComponents> = this._onCallback.event;
private readonly _onCallback: Emitter<URI> = this._register(new Emitter<URI>());
readonly onCallback: Event<URI> = this._onCallback.event;
create(options?: Partial<UriComponents>): URI {
const queryValues: Map<string, string> = new Map();
@@ -164,7 +164,7 @@ class PollingURLCallbackProvider extends Disposable implements IURLCallbackProvi
const content = await streamToBuffer(result.stream);
if (content.byteLength > 0) {
try {
this._onCallback.fire(JSON.parse(content.toString()));
this._onCallback.fire(URI.revive(JSON.parse(content.toString())));
} catch (error) {
console.error(error);
}
@@ -201,4 +201,12 @@ const options: IWorkbenchConstructionOptions = JSON.parse(document.getElementByI
options.urlCallbackProvider = new PollingURLCallbackProvider();
options.credentialsProvider = new LocalStorageCredentialsProvider();
if (options.folderUri) {
options.folderUri = URI.revive(options.folderUri);
}
if (options.workspaceUri) {
options.workspaceUri = URI.revive(options.workspaceUri);
}
create(document.body, options);