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