Last active
April 6, 2018 12:32
-
-
Save kmaraz/232661ce513316ee25f21e87fcee0951 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface RegisterEffects { ngRegisterEffects(): void; } | |
export const EFFECTS_CLASS = new InjectionToken<RegisterEffects[]>('EFFECTS_CLASS'); | |
export function EffectsProvider<T extends RegisterEffects>( | |
effectsClass: Type<T>): ClassProvider { | |
return { | |
multi: true, | |
provide: EFFECTS_CLASS, | |
useClass: effectsClass | |
}; | |
} | |
export function getEffectProviders() { | |
return [ | |
// For each module we need to get its effects class | |
// and return it as a injectable. Also in the `ngDoBootstrap` | |
// wee need to call its method `ngRegisterEffects`. | |
EffectsProvider(EventsEffects) | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment