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