Add a sleep utility function.
This commit is contained in:
parent
99180035e3
commit
c818362773
|
@ -7,6 +7,7 @@ export * from "./http.js";
|
|||
export * from "./logging.js";
|
||||
export * from "./query-selectors.js";
|
||||
export * from "./report-a-bug.js";
|
||||
export * from "./sleep.js";
|
||||
export * from "./text.js";
|
||||
export * from "./user.js";
|
||||
export * from "./validators.js";
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Promisified {@linkcode window.setTimeout}.
|
||||
* @param timeout The amount of time in milliseconds to sleep for.
|
||||
*/
|
||||
export async function sleep(timeout: number): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
window.setTimeout(resolve, timeout);
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue