UNPKG

1.7 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var core_1 = require("@angular/core");
4var store_1 = require("@ngrx/store");
5var config_config_1 = require("../../config.config");
6var reducers_1 = require("../../reducers");
7var BehaviorSubject_1 = require("rxjs/BehaviorSubject");
8var ConfigurationService = /** @class */ (function () {
9 function ConfigurationService(configFile, store) {
10 var _this = this;
11 this.store = store;
12 this.config$ = new BehaviorSubject_1.BehaviorSubject(this._config);
13 this._config = Object.assign({}, config_config_1.MODULE_DEFAULT_CONFIG, configFile);
14 this.config$.next(this._config);
15 this.store.select(reducers_1.getConfigModuleConfig).subscribe(function (configConfig) {
16 if (!configConfig)
17 return;
18 _this._config = Object.assign({}, _this._config, configConfig.Config);
19 _this.config$.next(_this._config);
20 });
21 }
22 Object.defineProperty(ConfigurationService.prototype, "config", {
23 get: function () {
24 return this._config;
25 },
26 enumerable: true,
27 configurable: true
28 });
29 ConfigurationService.decorators = [
30 { type: core_1.Injectable },
31 ];
32 /** @nocollapse */
33 ConfigurationService.ctorParameters = function () { return [
34 { type: undefined, decorators: [{ type: core_1.Inject, args: [config_config_1.MODULE_CONFIG_TOKEN,] },] },
35 { type: store_1.Store, },
36 ]; };
37 return ConfigurationService;
38}());
39exports.ConfigurationService = ConfigurationService;
40//# sourceMappingURL=configuration.service.js.map
\No newline at end of file