mirror of
https://github.com/denoland/deno.git
synced 2025-02-19 03:43:00 -05:00

This PR is part of #22907 --------- Signed-off-by: HasanAlrimawi <141642411+HasanAlrimawi@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
25 lines
489 B
TypeScript
25 lines
489 B
TypeScript
let interval: number | null = null;
|
|
addEventListener("load", () => {
|
|
if (interval) {
|
|
throw new Error("Interval is already set");
|
|
}
|
|
|
|
console.log("load");
|
|
interval = setInterval(() => {}, 0);
|
|
});
|
|
|
|
addEventListener("unload", () => {
|
|
if (!interval) {
|
|
throw new Error("Interval was not set");
|
|
}
|
|
|
|
console.log("unload");
|
|
clearInterval(interval);
|
|
});
|
|
|
|
Deno.test("test", () => {
|
|
console.log("test");
|
|
if (!interval) {
|
|
throw new Error("Interval was not set");
|
|
}
|
|
});
|