@datorama/akita-ng-effects
Version:
A Reactive State Management extension dealing with side effects.
37 lines • 1.65 kB
JavaScript
import { Inject, NgModule, Optional, SkipSelf } from '@angular/core';
import { ROOT_EFFECT_INSTANCES } from './tokens';
import { Actions } from './actions';
import { ModuleManager } from './module-manager.service';
var EffectsRootModule = /** @class */ (function () {
function EffectsRootModule(moduleManager, actions, rootEffects, parentModule) {
var _this = this;
this.moduleManager = moduleManager;
this.actions = actions;
this.parentModule = parentModule;
this.rootGuard();
rootEffects.forEach(function (effect) { return _this.moduleManager.subscribeToEffects(effect); });
}
EffectsRootModule.prototype.rootGuard = function () {
if (this.parentModule) {
throw new Error('EffectsRootModule is already loaded. Import it in the AppModule only');
}
};
EffectsRootModule.ctorParameters = function () { return [
{ type: ModuleManager },
{ type: Actions },
{ type: Array, decorators: [{ type: Inject, args: [ROOT_EFFECT_INSTANCES,] }] },
{ type: EffectsRootModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
]; };
EffectsRootModule.decorators = [
{ type: NgModule }
];
EffectsRootModule.ctorParameters = function () { return [
{ type: ModuleManager },
{ type: Actions },
{ type: Array, decorators: [{ type: Inject, args: [ROOT_EFFECT_INSTANCES,] }] },
{ type: EffectsRootModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
]; };
return EffectsRootModule;
}());
export { EffectsRootModule };
//# sourceMappingURL=effect-root.module.js.map