2023-09-15 12:32:25 -04:00
|
|
|
/**
|
2025-01-08 11:58:58 -05:00
|
|
|
* Waits for a number of milliseconds.
|
|
|
|
|
*
|
|
|
|
|
* @param milliseconds The number of milliseconds to wait.
|
|
|
|
|
* @returns Resolves with 'done!' after the wait is over.
|
2023-09-15 12:32:25 -04:00
|
|
|
*/
|
|
|
|
|
export async function wait(milliseconds: number): Promise<string> {
|
2025-01-08 11:58:58 -05:00
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
if (isNaN(milliseconds)) throw new Error('milliseconds is not a number')
|
2023-09-15 12:32:25 -04:00
|
|
|
|
|
|
|
|
setTimeout(() => resolve('done!'), milliseconds)
|
|
|
|
|
})
|
|
|
|
|
}
|