1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-27 16:10:57 -05:00
denoland-deno/tests/testdata/run/onload/imported.ts

14 lines
486 B
TypeScript
Raw Normal View History

// deno-lint-ignore-file no-window-prefix
import { assert } from "../../../../tests/util/std/assert/mod.ts";
2019-07-16 00:19:26 -04:00
import "./nest_imported.ts";
2019-10-02 11:32:51 -04:00
const handler = (e: Event) => {
assert(e.type === "beforeunload" ? e.cancelable : !e.cancelable);
2019-10-02 11:32:51 -04:00
console.log(`got ${e.type} event in event handler (imported)`);
};
window.addEventListener("load", handler);
window.addEventListener("beforeunload", handler);
2019-10-02 11:32:51 -04:00
window.addEventListener("unload", handler);
2019-07-16 00:19:26 -04:00
console.log("log from imported script");