Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 896ee83

Browse files
committed
show loading text while waiting for page
1 parent a955d6f commit 896ee83

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

shells/firefox/data/panel.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
background-color: white;
2424
font-family: sans-serif;
2525
}
26-
#container h1 {
26+
#message {
2727
margin: 20px auto;
28+
color: #ccc;
2829
}
2930
#logs {
3031
position: fixed;

shells/firefox/main/ReactPanel.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ const ReactPanel = Class({
4646
worker.port.on('hasReact', function (hasReact) {
4747
metaAddonSide.postMessage({type: 'hasReact', val: hasReact});
4848
});
49+
worker.port.on('unload', function () {
50+
metaAddonSide.postMessage('unload');
51+
});
4952
worker.on('error', function (error) {
5053
console.log('More Error!!', error);
5154
});

shells/firefox/panel/run.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ window.addEventListener('message', function (event) {
3232
metaPort.onmessage = evt => {
3333
if (evt.data === 'show') {
3434
reload();
35+
} else if (evt.data === 'unload') {
36+
node.innerHTML = '<h1 id="message">Looking for React</h1>';
3537
} else if (evt.data.type === 'hasReact') {
3638
if (evt.data.val) {
3739
React.render(<Panel alreadyFoundReact={true} {...config} />, node);
3840
} else {
39-
node.innerHTML = '<h1>No react found on page...</h1>';
41+
node.innerHTML = '<h1 id="message">No react found on page...</h1>';
4042
}
4143
}
4244
};

shells/firefox/src/contentScript.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ if (Object.keys(unsafeWindow.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers).length)
2222
self.port.emit('hasReact', false);
2323
}
2424

25+
window.addEventListener('beforeunload', () => {
26+
self.port.emit('unload');
27+
});
28+
2529
function connectToBackend() {
2630
self.port.on('message', function (payload) {
2731
window.postMessage({

0 commit comments

Comments
 (0)