2021-12-10 09:12:21 +11:00
|
|
|
// deno-lint-ignore-file no-window-prefix no-prototype-builtins
|
2021-08-11 10:20:47 -04:00
|
|
|
import { assert } from "../../../../test_util/std/testing/asserts.ts";
|
2019-07-16 13:19:26 +09:00
|
|
|
import "./imported.ts";
|
|
|
|
|
2020-12-07 22:22:58 +02:00
|
|
|
assert(window.hasOwnProperty("onload"));
|
|
|
|
assert(window.onload === null);
|
|
|
|
|
2021-08-05 13:08:58 +02:00
|
|
|
const eventHandler = (e: Event) => {
|
2019-10-02 17:32:51 +02:00
|
|
|
assert(!e.cancelable);
|
|
|
|
console.log(`got ${e.type} event in event handler (main)`);
|
|
|
|
};
|
|
|
|
|
|
|
|
window.addEventListener("load", eventHandler);
|
|
|
|
|
|
|
|
window.addEventListener("unload", eventHandler);
|
2019-07-16 13:19:26 +09:00
|
|
|
|
2021-08-05 13:08:58 +02:00
|
|
|
window.onload = (e: Event) => {
|
2019-10-02 17:32:51 +02:00
|
|
|
assert(!e.cancelable);
|
2019-07-16 13:19:26 +09:00
|
|
|
console.log(`got ${e.type} event in onload function`);
|
|
|
|
};
|
|
|
|
|
2021-08-05 13:08:58 +02:00
|
|
|
window.onunload = (e: Event) => {
|
2019-10-02 17:32:51 +02:00
|
|
|
assert(!e.cancelable);
|
|
|
|
console.log(`got ${e.type} event in onunload function`);
|
|
|
|
};
|
|
|
|
|
2019-07-16 13:19:26 +09:00
|
|
|
console.log("log from main");
|