/** * Wait for a number of milliseconds. * @param milliseconds The number of milliseconds to wait. * @returns {Promise} Resolves with 'done!' after the wait is over. */ export async function wait(milliseconds: number): Promise { return new Promise(resolve => { if (isNaN(milliseconds)) { throw new Error('milliseconds not a number') } setTimeout(() => resolve('done!'), milliseconds) }) }