Skip to content

Commit 7f5dee8

Browse files
committed
Detect when the tab is reactivated
1 parent c1f043a commit 7f5dee8

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/browser/extension/inject/contentScript.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,3 @@ if (typeof window.onbeforeunload !== 'undefined') {
4545
sendMessage({ type: 'PAGE_UNLOADED' });
4646
};
4747
}
48-
49-
// Detect when the tab is reactivated
50-
document.addEventListener('visibilitychange', function() {
51-
if (!isAllowed()) return;
52-
if (document.visibilityState === 'visible' && payload) {
53-
sendMessage({
54-
payload: payload,
55-
source: 'redux-page',
56-
init: true
57-
});
58-
}
59-
}, false);

src/browser/extension/inject/pageScript.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ window.devToolsExtension = function(next) {
107107
}
108108
return true;
109109
});
110+
111+
// Detect when the tab is reactivated
112+
document.addEventListener('visibilitychange', function() {
113+
if (document.visibilityState === 'visible') {
114+
shouldInit = true;
115+
relay('STATE', store.liftedStore.getState());
116+
}
117+
}, false);
110118
}
111119

112120
if (next) {

0 commit comments

Comments
 (0)