2019-10-04 14:49:32 -04:00
|
|
|
import { assert } from "../../../std/testing/asserts.ts";
|
2019-07-16 00:19:26 -04:00
|
|
|
import "./imported.ts";
|
|
|
|
|
2019-10-02 11:32:51 -04:00
|
|
|
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);
|
2019-07-16 00:19:26 -04:00
|
|
|
|
|
|
|
window.onload = (e: Event): void => {
|
2019-10-02 11:32:51 -04:00
|
|
|
assert(!e.cancelable);
|
2019-07-16 00:19:26 -04:00
|
|
|
console.log(`got ${e.type} event in onload function`);
|
|
|
|
};
|
|
|
|
|
2019-10-02 11:32:51 -04:00
|
|
|
window.onunload = (e: Event): void => {
|
|
|
|
assert(!e.cancelable);
|
|
|
|
console.log(`got ${e.type} event in onunload function`);
|
|
|
|
};
|
|
|
|
|
2019-07-16 00:19:26 -04:00
|
|
|
console.log("log from main");
|