| 175 | | DispatchMessage<S, A>; |
| 176 | |
| 177 | class DevToolsEnhancer<S, A extends Action<unknown>> { |
| 178 | // eslint-disable-next-line @typescript-eslint/ban-types |
| 179 | store!: EnhancedStore<S, A, {}>; |
| 180 | filters: LocalFilter | undefined; |
| 181 | instanceId?: string; |
| 182 | socket?: SCClientSocket; |
| 183 | sendTo?: string; |
| 184 | instanceName: string | undefined; |
| 185 | appInstanceId!: string; |
| 186 | stateSanitizer: ((state: S, index?: number) => S) | undefined; |
| 187 | actionSanitizer: ((action: A, id?: number) => A) | undefined; |
| 188 | isExcess?: boolean; |
| 189 | actionCreators?: (() => ActionCreatorObject[]) | ActionCreatorObject[]; |
| 190 | isMonitored?: boolean; |
| 191 | lastErrorMsg?: string | Event; |
| 192 | started?: boolean; |
| 193 | socketOptions!: SocketOptions; |
| 194 | suppressConnectErrors!: boolean; |
| 195 | startOn: readonly string[] | undefined; |
| 196 | stopOn: readonly string[] | undefined; |
| 197 | sendOn: readonly string[] | undefined; |
| 198 | sendOnError: number | undefined; |
| 199 | channel?: string; |
| 200 | errorCounts: { [errorName: string]: number } = {}; |
| 201 | lastAction?: unknown; |
| 202 | paused?: boolean; |
| 203 | locked?: boolean; |
| 204 | |
| 205 | getLiftedStateRaw() { |
| 206 | return this.store.liftedStore.getState(); |
| 207 | } |
| 208 | |
| 209 | getLiftedState() { |
| 210 | return filterStagedActions(this.getLiftedStateRaw(), this.filters); |
| 211 | } |
| 212 | |
| 213 | send = () => { |
| 214 | if (!this.instanceId) |
| 215 | this.instanceId = (this.socket && this.socket.id) || getRandomId(); |
| 216 | try { |
| 217 | fetch(this.sendTo!, { |
| 218 | method: 'POST', |
| 219 | headers: { |
| 220 | 'content-type': 'application/json', |
| 221 | }, |
| 222 | body: JSON.stringify({ |
| 223 | type: 'STATE', |
| 224 | id: this.instanceId, |
| 225 | name: this.instanceName, |
| 226 | payload: stringify(this.getLiftedState()), |
| 227 | }), |
| 228 | }).catch(function (err) { |
| 229 | console.log(err); |
| 230 | }); |
| 231 | } catch (err) { |
| 232 | console.log(err); |
| 233 | } |
| 234 | }; |
nothing calls this directly
no test coverage detected
searching dependent graphs…