mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-06-28 00:43:04 +03:00
Updates
This commit is contained in:
parent
9580a467de
commit
458d8750b4
|
@ -249,7 +249,6 @@ const chunks: {
|
||||||
>;
|
>;
|
||||||
} = {};
|
} = {};
|
||||||
let monitors = 0;
|
let monitors = 0;
|
||||||
let isMonitored = false;
|
|
||||||
|
|
||||||
const getId = (sender: chrome.runtime.MessageSender, name?: string) =>
|
const getId = (sender: chrome.runtime.MessageSender, name?: string) =>
|
||||||
sender.tab ? sender.tab.id! : name || sender.id!;
|
sender.tab ? sender.tab.id! : name || sender.id!;
|
||||||
|
@ -418,7 +417,6 @@ function toAllTabs(msg: TabMessage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function monitorInstances(shouldMonitor: boolean, id?: string) {
|
function monitorInstances(shouldMonitor: boolean, id?: string) {
|
||||||
if (!id && isMonitored === shouldMonitor) return;
|
|
||||||
const action = {
|
const action = {
|
||||||
type: shouldMonitor ? ('START' as const) : ('STOP' as const),
|
type: shouldMonitor ? ('START' as const) : ('STOP' as const),
|
||||||
};
|
};
|
||||||
|
@ -427,7 +425,6 @@ function monitorInstances(shouldMonitor: boolean, id?: string) {
|
||||||
} else {
|
} else {
|
||||||
toAllTabs(action);
|
toAllTabs(action);
|
||||||
}
|
}
|
||||||
isMonitored = shouldMonitor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReducerError() {
|
function getReducerError() {
|
||||||
|
@ -594,7 +591,7 @@ function onConnect<S, A extends Action<string>>(port: chrome.runtime.Port) {
|
||||||
chrome.action.enable(id);
|
chrome.action.enable(id);
|
||||||
chrome.action.setIcon({ tabId: id, path: 'img/logo/38x38.png' });
|
chrome.action.setIcon({ tabId: id, path: 'img/logo/38x38.png' });
|
||||||
}
|
}
|
||||||
if (isMonitored) port.postMessage({ type: 'START' });
|
port.postMessage({ type: 'START' });
|
||||||
|
|
||||||
const state = store.getState();
|
const state = store.getState();
|
||||||
if (state.instances.persisted) {
|
if (state.instances.persisted) {
|
||||||
|
@ -623,6 +620,11 @@ function onConnect<S, A extends Action<string>>(port: chrome.runtime.Port) {
|
||||||
id = getId(port.sender!, port.name);
|
id = getId(port.sender!, port.name);
|
||||||
connections.monitor[id] = port;
|
connections.monitor[id] = port;
|
||||||
monitorInstances(true);
|
monitorInstances(true);
|
||||||
|
listener = (msg: BackgroundAction | 'heartbeat') => {
|
||||||
|
if (msg === 'heartbeat') return;
|
||||||
|
store.dispatch(msg);
|
||||||
|
};
|
||||||
|
port.onMessage.addListener(listener);
|
||||||
monitors++;
|
monitors++;
|
||||||
port.onDisconnect.addListener(disconnect('monitor', id));
|
port.onDisconnect.addListener(disconnect('monitor', id));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,10 +5,6 @@ html
|
||||||
meta(charset='UTF-8')
|
meta(charset='UTF-8')
|
||||||
title Redux DevTools
|
title Redux DevTools
|
||||||
include ../style.pug
|
include ../style.pug
|
||||||
style.
|
|
||||||
body {
|
|
||||||
min-height: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body
|
body
|
||||||
#root
|
#root
|
||||||
|
|
Loading…
Reference in New Issue
Block a user