Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else if (currencyPairUpdate.updateType === UpdateType.Removed && _this._workspaceItemsById.hasOwnProperty(key)) {
let workspaceItem = _this._workspaceItemsById[key];
delete _this._workspaceItemsById[key];
let removeAtIndex = this.workspaceItems.indexOf(workspaceItem);
if (removeAtIndex > -1) {
this.workspaceItems.splice(removeAtIndex, 1);
}
// fire an event at the spot tile model telling it that it's been closed
_this.router.publishEvent(workspaceItem.modelId, 'tileClosed', {});
}
});
}
@observeEvent('tearOffWorkspaceItem')
_onTearoff(e:{itemId:string}) {
_log.debug(`Tearing off workspace item with id [${e.itemId}].`);
}
}
_referenceDataService:ReferenceDataService;
_spotTileFactory:SpotTileFactory;
_workspaceItemsById:Object;
_isInitialised:boolean;
workspaceItems:Array;
constructor(router:Router, referenceDataService:ReferenceDataService, spotTileFactory:SpotTileFactory) {
super('workspaceModelId', router);
this._referenceDataService = referenceDataService;
this._spotTileFactory = spotTileFactory;
this._workspaceItemsById = {};
this._isInitialised = false;
this.workspaceItems = [];
}
@observeEvent('init')
_onInit() {
let _this = this;
if (!_this._isInitialised) {
_this._isInitialised = true;
_this.addDisposable(
_this._referenceDataService.getCurrencyPairUpdatesStream().subscribeWithRouter(
_this.router,
_this.modelId,
(referenceData:CurrencyPairUpdates) => {
_this._processCurrencyPairUpdate(referenceData.currencyPairUpdates);
}
)
);
}
}