mirror of
https://github.com/actions/javascript-action.git
synced 2025-12-12 15:12:44 +00:00
Restructure source and tests
This commit is contained in:
17
src/wait.js
Normal file
17
src/wait.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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 }
|
||||
Reference in New Issue
Block a user