Author: ygrego Date: 2015-06-22 08:16:07 +0000 (Mon, 22 Jun 2015) New Revision: 1754 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1754 Log: Avoid that some classes depending of ChannelService object try to get it while this one is not yet created by the oipf factory. Modified: oipf/lib/js/impl/OipfObjectFactory.js Modified: oipf/lib/js/impl/OipfObjectFactory.js =================================================================== --- oipf/lib/js/impl/OipfObjectFactory.js 2015-06-18 15:56:44 UTC (rev 1753) +++ oipf/lib/js/impl/OipfObjectFactory.js 2015-06-22 08:16:07 UTC (rev 1754) @@ -6,9 +6,11 @@ constructor() { console.log("[INFO] constructor of OipfObjectFactory class called."); + this._setChannelServicePromise(); var modelFactory = new ModelFactory(); var dateUtils = new DateUtils(); this._oipfConfiguration = new OipfConfiguration(); + this._channelService = null; /*The ChannelConfig class provides the entry point for applications to get information about the list of channels * available. It can be obtained in two ways: @@ -639,6 +641,7 @@ this._oipfConfiguration.channelOrigin, channelListJson.channelList.channel ); + this._channelServicePromise.resolve(this._channelService); this.channelConfig = new ChannelConfig(this._channelService); } @@ -653,4 +656,24 @@ this.searchManagerObject = new SearchManagerObject(programmeService); } + + _getChannelServicePromise() { + + return this._channelServicePromise; + } + + _setChannelServicePromise() { + this._channelServicePromise = { + promise: null, + resolve: null, + reject: null + }; + + var self = this; + + this._channelServicePromise.promise = new Promise(function(resolve, reject) { + self._channelServicePromise.resolve = resolve; + self._channelServicePromise.reject = reject; + }); + } }