mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-27 04:35:25 +00:00
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);
|
||||
|
||||
let appWindow: Window | undefined;
|
||||
|
||||
window.addEventListener("beforeunload", (e) => {
|
||||
e.preventDefault(); // FireFox
|
||||
e.returnValue = ""; // Chrome
|
||||
});
|
||||
|
||||
window.addEventListener("message", (event) => {
|
||||
if (event.data === "app") {
|
||||
appWindow = event.source as Window;
|
||||
|
Loading…
Reference in New Issue
Block a user