mirror of
https://github.com/denoland/deno.git
synced 2024-12-20 06:15:44 -05:00
c92717a1a4
Moving tests around so that we can make #22413 smaller
22 lines
497 B
TypeScript
22 lines
497 B
TypeScript
let intervalHandle: number;
|
|
let firstIntervalPromise: Promise<void>;
|
|
|
|
addEventListener("load", () => {
|
|
firstIntervalPromise = new Promise((resolve) => {
|
|
let firstIntervalCalled = false;
|
|
intervalHandle = setInterval(() => {
|
|
if (!firstIntervalCalled) {
|
|
resolve();
|
|
firstIntervalCalled = true;
|
|
}
|
|
}, 5);
|
|
});
|
|
});
|
|
|
|
addEventListener("unload", () => {
|
|
clearInterval(intervalHandle);
|
|
});
|
|
|
|
Deno.test("wait", async function () {
|
|
await firstIntervalPromise;
|
|
});
|