提交 5d57ba9f 编写于 作者: A Alex Dima

SimpleWorker: guard initialization promise from cancelation

上级 3e19a415
......@@ -195,7 +195,7 @@ export class SimpleWorkerClient<T> extends Disposable {
moduleId,
loaderConfiguration
]);
this._onModuleLoaded.then(null, () => this._onError('Worker failed to load ' + moduleId));
this._onModuleLoaded.then(null, (e) => this._onError('Worker failed to load ' + moduleId, e));
// Create proxy to loaded code
let proxyMethodRequest = (method:string, args:any[]):TPromise<any> => {
......@@ -224,8 +224,12 @@ export class SimpleWorkerClient<T> extends Disposable {
}
private _request(method:string, args:any[]): TPromise<any> {
return this._onModuleLoaded.then(() => {
return this._protocol.sendMessage(method, args);
return new TPromise<any>((c, e, p) => {
this._onModuleLoaded.then(() => {
this._protocol.sendMessage(method, args).then(c, e);
}, e);
}, () => {
// Cancel intentionally not supported
});
}
......
......@@ -80,7 +80,7 @@ export class WorkerClient {
loaderConfiguration: loaderConfiguration,
MonacoEnvironment: MonacoEnvironment
});
this.onModuleLoaded.then(null, () => this._onError('Worker failed to load ' + moduleId));
this.onModuleLoaded.then(null, (e) => this._onError('Worker failed to load ' + moduleId, e));
this._remoteCom = new protocol.RemoteCom(this);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册