mirror of
https://github.com/actions/typescript-action.git
synced 2025-12-14 22:20:53 +00:00
Convert to ESM
This commit is contained in:
11
src/wait.ts
11
src/wait.ts
@@ -1,13 +1,12 @@
|
||||
/**
|
||||
* Wait for a number of milliseconds.
|
||||
* Waits for a number of milliseconds.
|
||||
*
|
||||
* @param milliseconds The number of milliseconds to wait.
|
||||
* @returns {Promise<string>} Resolves with 'done!' after the wait is over.
|
||||
* @returns Resolves with 'done!' after the wait is over.
|
||||
*/
|
||||
export async function wait(milliseconds: number): Promise<string> {
|
||||
return new Promise(resolve => {
|
||||
if (isNaN(milliseconds)) {
|
||||
throw new Error('milliseconds not a number')
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
if (isNaN(milliseconds)) throw new Error('milliseconds is not a number')
|
||||
|
||||
setTimeout(() => resolve('done!'), milliseconds)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user