Skip to content
This repository was archived by the owner on Dec 26, 2017. It is now read-only.

Commit a4dd162

Browse files
MerottMikeRyanDev
authored andcommitted
feat(DI): register individual effect instances with the DI (#13)
1 parent 9d0c294 commit a4dd162

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/run-effects.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ import { STATE_UPDATES_PROVIDER } from './state-updates';
66

77

88
export function runEffects(...effects: any[]) {
9-
const allEffects = flatten(effects)
10-
.map(effect => new Provider(BOOTSTRAP_EFFECTS, {
11-
useClass: effect,
9+
const individuals = flatten(effects);
10+
11+
const allEffects = individuals
12+
.map(effectClass => new Provider(BOOTSTRAP_EFFECTS, {
13+
useExisting: effectClass,
1214
multi: true
1315
}));
1416

1517
return [
18+
...individuals,
1619
...allEffects,
1720
CONNECT_EFFECTS_PROVIDER,
1821
STATE_UPDATES_PROVIDER

0 commit comments

Comments
 (0)