2021-08-15 07:54:44 -04:00
|
|
|
let interval: number | null = null;
|
|
|
|
addEventListener("load", () => {
|
|
|
|
if (interval) {
|
|
|
|
throw new Error("Interval is already set");
|
|
|
|
}
|
|
|
|
|
2024-02-28 17:12:21 -05:00
|
|
|
console.log("load");
|
2021-08-15 07:54:44 -04:00
|
|
|
interval = setInterval(() => {}, 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
addEventListener("unload", () => {
|
|
|
|
if (!interval) {
|
|
|
|
throw new Error("Interval was not set");
|
|
|
|
}
|
|
|
|
|
2024-02-28 17:12:21 -05:00
|
|
|
console.log("unload");
|
2021-08-15 07:54:44 -04:00
|
|
|
clearInterval(interval);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("test", () => {
|
2024-02-28 17:12:21 -05:00
|
|
|
console.log("test");
|
2021-08-15 07:54:44 -04:00
|
|
|
if (!interval) {
|
|
|
|
throw new Error("Interval was not set");
|
|
|
|
}
|
|
|
|
});
|