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 BehaviorSubject_1 = require("rxjs/BehaviorSubject");
|
6 | var config_1 = require("@soushians/config");
|
7 | var user_config_1 = require("../user.config");
|
8 |
|
9 | var UserConfigurationService = (function () {
|
10 | function UserConfigurationService(configFile, store) {
|
11 | var _this = this;
|
12 | this.store = store;
|
13 | this.config$ = new BehaviorSubject_1.BehaviorSubject(this._config);
|
14 | this._config = Object.assign({}, user_config_1.MODULE_DEFAULT_CONFIG, configFile);
|
15 | this.config$.next(this._config);
|
16 | this.store.select(config_1.getUserModuleConfig).subscribe(function (userConfig) {
|
17 | if (!userConfig)
|
18 | return;
|
19 | _this._config = Object.assign({}, _this._config, userConfig.Config);
|
20 | _this.config$.next(_this._config);
|
21 | });
|
22 | }
|
23 | Object.defineProperty(UserConfigurationService.prototype, "config", {
|
24 | get: function () {
|
25 | return this._config;
|
26 | },
|
27 | enumerable: true,
|
28 | configurable: true
|
29 | });
|
30 | UserConfigurationService.decorators = [
|
31 | { type: core_1.Injectable },
|
32 | ];
|
33 |
|
34 | UserConfigurationService.ctorParameters = function () { return [
|
35 | { type: undefined, decorators: [{ type: core_1.Inject, args: [user_config_1.MODULE_CONFIG_TOKEN,] },] },
|
36 | { type: store_1.Store, },
|
37 | ]; };
|
38 | return UserConfigurationService;
|
39 | }());
|
40 | exports.UserConfigurationService = UserConfigurationService;
|
41 |
|
\ | No newline at end of file |