mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
feat: window.onunload (#3023)
This commit is contained in:
parent
d32f39f2ec
commit
c920c5f62a
9 changed files with 126 additions and 20 deletions
|
@ -1,14 +1,23 @@
|
|||
import { assert } from "../../../js/deps/https/deno.land/std/testing/asserts.ts";
|
||||
import "./imported.ts";
|
||||
|
||||
window.addEventListener(
|
||||
"load",
|
||||
(e: Event): void => {
|
||||
console.log(`got ${e.type} event in event handler (main)`);
|
||||
}
|
||||
);
|
||||
const eventHandler = (e: Event): void => {
|
||||
assert(!e.cancelable);
|
||||
console.log(`got ${e.type} event in event handler (main)`);
|
||||
};
|
||||
|
||||
window.addEventListener("load", eventHandler);
|
||||
|
||||
window.addEventListener("unload", eventHandler);
|
||||
|
||||
window.onload = (e: Event): void => {
|
||||
assert(!e.cancelable);
|
||||
console.log(`got ${e.type} event in onload function`);
|
||||
};
|
||||
|
||||
window.onunload = (e: Event): void => {
|
||||
assert(!e.cancelable);
|
||||
console.log(`got ${e.type} event in onunload function`);
|
||||
};
|
||||
|
||||
console.log("log from main");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue