mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-04-25 02:33:42 +03:00
Keep connection from content script to background alive
This commit is contained in:
parent
8a332528a9
commit
35b98d82f7
|
@ -601,7 +601,8 @@ function onConnect<S, A extends Action<string>>(port: chrome.runtime.Port) {
|
|||
id = getId(port.sender!);
|
||||
if (port.sender!.frameId) id = `${id}-${port.sender!.frameId}`;
|
||||
connections.tab[id] = port;
|
||||
listener = (msg: ContentScriptToBackgroundMessage<S, A>) => {
|
||||
listener = (msg: ContentScriptToBackgroundMessage<S, A> | 'heartbeat') => {
|
||||
if (msg === 'heartbeat') return;
|
||||
if (msg.name === 'INIT_INSTANCE') {
|
||||
if (typeof id === 'number') {
|
||||
chrome.pageAction.show(id);
|
||||
|
|
|
@ -318,3 +318,7 @@ function handleMessages<S, A extends Action<string>>(
|
|||
}
|
||||
|
||||
window.addEventListener('message', handleMessages, false);
|
||||
|
||||
setInterval(() => {
|
||||
bg?.postMessage('heartbeat');
|
||||
}, 15000);
|
||||
|
|
Loading…
Reference in New Issue
Block a user