UNPKG

@datorama/akita-ng-effects

Version:

A Reactive State Management extension dealing with side effects.

34 lines 1.37 kB
import { Inject, NgModule, Optional, SkipSelf } from '@angular/core'; import { ROOT_EFFECT_INSTANCES } from './tokens'; import { Actions } from './actions'; import { ModuleManager } from './module-manager.service'; export class EffectsRootModule { constructor(moduleManager, actions, rootEffects, parentModule) { this.moduleManager = moduleManager; this.actions = actions; this.parentModule = parentModule; this.rootGuard(); rootEffects.forEach((effect) => this.moduleManager.subscribeToEffects(effect)); } rootGuard() { if (this.parentModule) { throw new Error('EffectsRootModule is already loaded. Import it in the AppModule only'); } } } EffectsRootModule.ctorParameters = () => [ { 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 = () => [ { type: ModuleManager }, { type: Actions }, { type: Array, decorators: [{ type: Inject, args: [ROOT_EFFECT_INSTANCES,] }] }, { type: EffectsRootModule, decorators: [{ type: Optional }, { type: SkipSelf }] } ]; //# sourceMappingURL=effect-root.module.js.map