(readonly ayanami: Ayanami<State>, private readonly config: Readonly<Config<State>>)
| 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() |
nothing calls this directly
no test coverage detected