Created
May 12, 2025 22:57
-
-
Save zvakanaka/f01f02f703dc64ef87946b1ac908dda7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Waits for a specified amount of time before resolving. | |
* @param {number} waitMs - The amount of time to wait in milliseconds | |
* @returns {Promise<void>} - A promise that resolves after the specified amount of time | |
*/ | |
const timeout = (waitMs) => { | |
return new Promise((resolve) => { | |
const timer = setTimeout(() => { | |
clearTimeout(timer) | |
resolve() | |
}, waitMs) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment