MCPcopy
hub / github.com/reduxjs/redux-devtools / DevToolsEnhancer

Class DevToolsEnhancer

packages/redux-devtools-remote/src/devTools.ts:177–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175 | DispatchMessage<S, A>;
176
177class 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 };

Callers

nothing calls this directly

Calls 12

getLiftedStateMethod · 0.95
relayMethod · 0.95
dispatchRemotelyMethod · 0.95
loginMethod · 0.95
getLiftedStateRawMethod · 0.95
initMethod · 0.95
handleChangeMethod · 0.95
filterStagedActionsFunction · 0.90
getRandomIdFunction · 0.85
asyncFunction · 0.85
configureStoreFunction · 0.70
stringifyFunction · 0.50

Tested by

no test coverage detected