MCPcopy Create free account
hub / github.com/ngrx/platform / constructor

Method constructor

modules/store-devtools/src/devtools.ts:52–147  ·  view source on GitHub ↗
(
    dispatcher: DevtoolsDispatcher,
    actions$: ActionsSubject,
    reducers$: ReducerObservable,
    extension: DevtoolsExtension,
    scannedActions: ScannedActionsSubject,
    errorHandler: ErrorHandler,
    @Inject(INITIAL_STATE) initialState: any,
    @Inject(STORE_DEVTOOLS_CONFIG) config: StoreDevtoolsConfig
  )

Source from the content-addressed store, hash-verified

50 public state: StateObservable;
51
52 constructor(
53 dispatcher: DevtoolsDispatcher,
54 actions$: ActionsSubject,
55 reducers$: ReducerObservable,
56 extension: DevtoolsExtension,
57 scannedActions: ScannedActionsSubject,
58 errorHandler: ErrorHandler,
59 @Inject(INITIAL_STATE) initialState: any,
60 @Inject(STORE_DEVTOOLS_CONFIG) config: StoreDevtoolsConfig
61 ) {
62 const liftedInitialState = liftInitialState(initialState, config.monitor);
63 const liftReducer = liftReducerWith(
64 initialState,
65 liftedInitialState,
66 errorHandler,
67 config.monitor,
68 config
69 );
70
71 const liftedAction$ = merge(
72 merge(actions$.asObservable().pipe(skip(1)), extension.actions$).pipe(
73 map(liftAction)
74 ),
75 dispatcher,
76 extension.liftedActions$
77 ).pipe(observeOn(queueScheduler));
78
79 const liftedReducer$ = reducers$.pipe(map(liftReducer));
80
81 const zoneConfig = injectZoneConfig(config.connectInZone!);
82
83 const liftedStateSubject = new ReplaySubject<LiftedState>(1);
84
85 this.liftedStateSubscription = liftedAction$
86 .pipe(
87 withLatestFrom(liftedReducer$),
88 // The extension would post messages back outside of the Angular zone
89 // because we call `connect()` wrapped with `runOutsideAngular`. We run change
90 // detection only once at the end after all the required asynchronous tasks have
91 // been processed (for instance, `setInterval` scheduled by the `timeout` operator).
92 // We have to re-enter the Angular zone before the `scan` since it runs the reducer
93 // which must be run within the Angular zone.
94 emitInZone(zoneConfig),
95 scan<
96 [any, ActionReducer<LiftedState, Actions.All>],
97 {
98 state: LiftedState;
99 action: any;
100 }
101 >(
102 ({ state: liftedState }, [action, reducer]) => {
103 let reducedLiftedState = reducer(liftedState, action);
104 // On full state update
105 // If we have actions filters, we must filter completely our lifted state to be sync with the extension
106 if (action.type !== PERFORM_ACTION && shouldFilterActions(config)) {
107 reducedLiftedState = filterLiftedState(
108 reducedLiftedState,
109 config.predicate,

Callers

nothing calls this directly

Calls 12

refreshMethod · 0.95
liftInitialStateFunction · 0.90
liftReducerWithFunction · 0.90
injectZoneConfigFunction · 0.90
shouldFilterActionsFunction · 0.90
filterLiftedStateFunction · 0.90
mergeFunction · 0.85
emitInZoneFunction · 0.85
subscribeMethod · 0.80
notifyMethod · 0.80
nextMethod · 0.65
reducerFunction · 0.50

Tested by

no test coverage detected