Javascript mode instantiated twice, issue #34

This commit is contained in:
Martin Aeschlimann 2015-11-17 16:00:11 +01:00
parent 4d78a2e833
commit 7569a9a775

View file

@ -187,13 +187,17 @@ export class ModeServiceImpl implements IModeService {
if (this._activationPromises.hasOwnProperty(modeId)) {
return this._activationPromises[modeId];
}
this._activationPromises[modeId] = this._createMode(modeId).then((mode) => {
var c, e;
var promise = new TPromise((cc,ee,pp) => { c = cc; e = ee; });
this._activationPromises[modeId] = promise;
this._createMode(modeId).then((mode) => {
this._instantiatedModes[modeId] = mode;
delete this._activationPromises[modeId];
return this._instantiatedModes[modeId];
});
return this._activationPromises[modeId];
}).then(c, e);
return promise;
}
protected _createMode(modeId:string): TPromise<Modes.IMode> {