-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ca33b7
commit e36d7a4
Showing
3 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Utils for working with promises. | ||
* | ||
* Promises are used in JavaScript to handle asynchronous operations. They are a way to handle the result of an asynchronous operation once it completes. | ||
* | ||
* You can await the completion of a promise using the `await` keyword. This will pause the execution of the current function until the promise resolves. | ||
* @module | ||
*/ | ||
|
||
/** | ||
* Returns a promise that resolves after a delay. | ||
* @param ms - the number of miliseconds to wait before resolving the promise. | ||
* @returns Promise that resolves after the specified delay. | ||
*/ | ||
export function sleep(ms: number) { | ||
return new Promise((r) => setTimeout(r, ms)); | ||
} |