Skip to content

Commit ec7ebe0

Browse files
committed
Replace window.onmessage with window.addEventListener
1 parent 272d721 commit ec7ebe0

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

hot/dev-server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ if(module.hot) {
3636

3737
});
3838
}
39-
window.onmessage = function(event) {
39+
window.addEventListener("message", function(event) {
4040
if(typeof event.data === "string" && event.data.indexOf("webpackHotUpdate") === 0) {
4141
lastData = event.data;
4242
if(!upToDate() && module.hot.status() === "idle") {
4343
console.log("[HMR] Checking for updates on the server...");
4444
check();
4545
}
4646
}
47-
};
47+
});
4848
console.log("[HMR] Waiting for update signal from WDS...");
4949
} else {
5050
throw new Error("[HMR] Hot Module Replacement is disabled");

hot/only-dev-server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ if(module.hot) {
6060
});
6161
});
6262
}
63-
window.onmessage = function(event) {
63+
window.addEventListener("message", function(event) {
6464
if(typeof event.data === "string" && event.data.indexOf("webpackHotUpdate") === 0) {
6565
lastData = event.data;
6666
if(!upToDate() && module.hot.status() === "idle") {
6767
console.log("[HMR] Checking for updates on the server...");
6868
check();
6969
}
7070
}
71-
};
71+
});
7272
console.log("[HMR] Waiting for update signal from WDS...");
7373
} else {
7474
throw new Error("[HMR] Hot Module Replacement is disabled");

0 commit comments

Comments
 (0)