MCPcopy Create free account
hub / github.com/LeetCode-OpenSource/ayanami / constructor

Method constructor

src/core/ikari.ts:110–163  ·  view source on GitHub ↗
(readonly ayanami: Ayanami<State>, private readonly config: Readonly<Config<State>>)

Source from the content-addressed store, hash-verified

108
109 // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
110 constructor(readonly ayanami: Ayanami<State>, private readonly config: Readonly<Config<State>>) {
111 const [effectActions$, effectActions] = setupEffectActions(
112 this.config.effects,
113 this.state.state$,
114 )
115
116 const [reducerActions$, reducerActions] = setupReducerActions(
117 this.config.reducers,
118 this.state.getState,
119 )
120
121 const [immerReducerActions$, immerReducerActions] = setupImmerReducerActions(
122 this.config.immerReducers,
123 this.state.getState,
124 )
125
126 this.triggerActions = {
127 ...effectActions,
128 ...reducerActions,
129 ...immerReducerActions,
130 ...mapValues(this.config.defineActions, ({ next }) => next),
131 }
132
133 let effectActionsWithTerminate$: Observable<Action<any>>
134
135 if (!isSSREnabled()) {
136 effectActionsWithTerminate$ = effectActions$
137 } else {
138 effectActionsWithTerminate$ = effectActions$.pipe(
139 takeUntil(this.terminate$.pipe(filter((action) => action === null))),
140 )
141 }
142
143 this.subscription.add(
144 effectActionsWithTerminate$.subscribe((action) => {
145 this.log(action)
146 this.handleAction(action)
147 }),
148 )
149
150 this.subscription.add(
151 reducerActions$.subscribe((action) => {
152 this.log(action)
153 this.handleAction(action)
154 }),
155 )
156
157 this.subscription.add(
158 immerReducerActions$.subscribe((action) => {
159 this.log(action)
160 this.handleAction(action)
161 }),
162 )
163 }
164
165 destroy(): void {
166 this.subscription.unsubscribe()

Callers

nothing calls this directly

Calls 5

isSSREnabledFunction · 0.90
setupEffectActionsFunction · 0.85
setupReducerActionsFunction · 0.85
setupImmerReducerActionsFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected