mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-04-27 11:43:42 +03:00
Keep connection from devpanel to background alive
This commit is contained in:
parent
b164f492df
commit
8a332528a9
|
@ -644,7 +644,8 @@ function onConnect<S, A extends Action<string>>(port: chrome.runtime.Port) {
|
||||||
connections.panel[id] = port;
|
connections.panel[id] = port;
|
||||||
monitorInstances(true, port.name);
|
monitorInstances(true, port.name);
|
||||||
monitors++;
|
monitors++;
|
||||||
listener = (msg: BackgroundAction) => {
|
listener = (msg: BackgroundAction | 'heartbeat') => {
|
||||||
|
if (msg === 'heartbeat') return;
|
||||||
store.dispatch(msg);
|
store.dispatch(msg);
|
||||||
};
|
};
|
||||||
port.onMessage.addListener(listener);
|
port.onMessage.addListener(listener);
|
||||||
|
|
|
@ -103,9 +103,15 @@ let splitMessage: SplitUpdateStateRequest<unknown, Action<string>>;
|
||||||
|
|
||||||
function init(id: number) {
|
function init(id: number) {
|
||||||
renderNA();
|
renderNA();
|
||||||
|
|
||||||
bgConnection = chrome.runtime.connect({
|
bgConnection = chrome.runtime.connect({
|
||||||
name: id ? id.toString() : undefined,
|
name: id ? id.toString() : undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
bgConnection.postMessage('heartbeat');
|
||||||
|
}, 15000);
|
||||||
|
|
||||||
bgConnection.onMessage.addListener(
|
bgConnection.onMessage.addListener(
|
||||||
<S, A extends Action<string>>(
|
<S, A extends Action<string>>(
|
||||||
message: PanelMessageWithSplitAction<S, A>,
|
message: PanelMessageWithSplitAction<S, A>,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user