mirror of
https://github.com/actions/javascript-action.git
synced 2026-02-01 22:38:37 +08:00
18 lines
439 B
JavaScript
18 lines
439 B
JavaScript
/**
|
|
* Wait for a number of milliseconds.
|
|
*
|
|
* @param {number} milliseconds The number of milliseconds to wait.
|
|
* @returns {Promise<string>} Resolves with 'done!' after the wait is over.
|
|
*/
|
|
async function wait(milliseconds) {
|
|
return new Promise(resolve => {
|
|
if (isNaN(milliseconds)) {
|
|
throw new Error('milliseconds not a number')
|
|
}
|
|
|
|
setTimeout(() => resolve('done!'), milliseconds)
|
|
})
|
|
}
|
|
|
|
module.exports = { wait }
|