mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Implemented reload-and-profile. Also fixed an couple of minor profiling bugs along the way
This commit is contained in:
@@ -61,13 +61,17 @@ port.onDisconnect.addListener(handleDisconnect);
|
||||
|
||||
window.addEventListener('message', handleMessageFromPage);
|
||||
|
||||
sayHelloToBackend();
|
||||
|
||||
// The backend waits to install the global hook until notified by the content script.
|
||||
// In the event of a page reload, the content script might be loaded before the backend is injected.
|
||||
// Because of this we need to poll the backend until it has been initialized.
|
||||
const intervalID = setInterval(() => {
|
||||
if (backendInitialized || backendDisconnected) {
|
||||
clearInterval(intervalID);
|
||||
} else {
|
||||
sayHelloToBackend();
|
||||
}
|
||||
}, 500);
|
||||
if (!backendInitialized) {
|
||||
const intervalID = setInterval(() => {
|
||||
if (backendInitialized || backendDisconnected) {
|
||||
clearInterval(intervalID);
|
||||
} else {
|
||||
sayHelloToBackend();
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user