1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var core_1 = require("@angular/core");
|
4 | var store_1 = require("@ngrx/store");
|
5 | var config_config_1 = require("../../config.config");
|
6 | var reducers_1 = require("../../reducers");
|
7 | var BehaviorSubject_1 = require("rxjs/BehaviorSubject");
|
8 | var ConfigurationService = (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 |
|
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 | }());
|
39 | exports.ConfigurationService = ConfigurationService;
|
40 |
|
\ | No newline at end of file |