feat: window.onunload (#3023)

This commit is contained in:
Bartek Iwańczuk 2019-10-02 17:32:51 +02:00 committed by Ryan Dahl
parent d32f39f2ec
commit c920c5f62a
9 changed files with 126 additions and 20 deletions

View file

@ -1,8 +1,11 @@
import { assert } from "../../../js/deps/https/deno.land/std/testing/asserts.ts";
import "./nest_imported.ts";
window.addEventListener(
"load",
(e: Event): void => {
console.log(`got ${e.type} event in event handler (imported)`);
}
);
const handler = (e: Event): void => {
assert(!e.cancelable);
console.log(`got ${e.type} event in event handler (imported)`);
};
window.addEventListener("load", handler);
window.addEventListener("unload", handler);
console.log("log from imported script");