Add confirmation for closing window (#463)
* Add confirmation for closing window * Make function an event listener for consistency * Change let to const * Refactor for compatability
This commit is contained in:
parent
630ccfcacc
commit
50e6108012
|
@ -34,6 +34,12 @@ export abstract class IdeClient {
|
||||||
this.loadTime = time(2500);
|
this.loadTime = time(2500);
|
||||||
|
|
||||||
let appWindow: Window | undefined;
|
let appWindow: Window | undefined;
|
||||||
|
|
||||||
|
window.addEventListener("beforeunload", (e) => {
|
||||||
|
e.preventDefault(); // FireFox
|
||||||
|
e.returnValue = ""; // Chrome
|
||||||
|
});
|
||||||
|
|
||||||
window.addEventListener("message", (event) => {
|
window.addEventListener("message", (event) => {
|
||||||
if (event.data === "app") {
|
if (event.data === "app") {
|
||||||
appWindow = event.source as Window;
|
appWindow = event.source as Window;
|
||||||
|
|
Loading…
Reference in New Issue