mirror of
https://github.com/denoland/deno.git
synced 2024-10-31 09:14:20 -04:00
22 lines
324 B
JavaScript
22 lines
324 B
JavaScript
|
let count = 0;
|
||
|
|
||
|
console.log("0");
|
||
|
|
||
|
globalThis.addEventListener("beforeunload", (e) => {
|
||
|
console.log("GOT EVENT");
|
||
|
if (count === 0 || count === 1) {
|
||
|
e.preventDefault();
|
||
|
setTimeout(() => {
|
||
|
console.log("3");
|
||
|
}, 100);
|
||
|
}
|
||
|
|
||
|
count++;
|
||
|
});
|
||
|
|
||
|
console.log("1");
|
||
|
|
||
|
setTimeout(() => {
|
||
|
console.log("2");
|
||
|
}, 100);
|