mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-02 02:43:09 +03:00
Simplify
This commit is contained in:
parent
ee43acccf5
commit
9f4f94b378
|
@ -394,13 +394,6 @@ function toAllTabs(msg: TabMessage) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function monitorInstances(shouldMonitor: boolean) {
|
|
||||||
const action = {
|
|
||||||
type: shouldMonitor ? ('START' as const) : ('STOP' as const),
|
|
||||||
};
|
|
||||||
toAllTabs(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getReducerError() {
|
function getReducerError() {
|
||||||
const instancesState = store.getState().instances;
|
const instancesState = store.getState().instances;
|
||||||
const payload = instancesState.states[instancesState.current];
|
const payload = instancesState.states[instancesState.current];
|
||||||
|
@ -535,7 +528,7 @@ function disconnect(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
monitors--;
|
monitors--;
|
||||||
if (monitors == 0) monitorInstances(false);
|
if (monitors == 0) toAllTabs({ type: 'STOP' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -587,7 +580,7 @@ function onConnect<S, A extends Action<string>>(port: chrome.runtime.Port) {
|
||||||
id = getId(port.sender!, port.name);
|
id = getId(port.sender!, port.name);
|
||||||
connections.panel[id] = port;
|
connections.panel[id] = port;
|
||||||
monitors++;
|
monitors++;
|
||||||
monitorInstances(true);
|
toAllTabs({ type: 'START' });
|
||||||
listener = (msg: BackgroundAction | 'heartbeat') => {
|
listener = (msg: BackgroundAction | 'heartbeat') => {
|
||||||
if (msg === 'heartbeat') return;
|
if (msg === 'heartbeat') return;
|
||||||
store.dispatch(msg);
|
store.dispatch(msg);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user