Skip to content

Commit

Permalink
Add options to delay
Browse files Browse the repository at this point in the history
  • Loading branch information
sajmoni committed Nov 27, 2022
1 parent bf718a5 commit cab0ec6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,18 @@ export const every = (
/**
* Resolves a promise after a delay
*/
export const delay = (delay = 1): Promise<void> =>
export const delay = (
delay = 1,
options: BehaviorOptions = {},
): Promise<void> =>
new Promise((resolve) => {
once(() => {
resolve()
}, delay)
once(
() => {
resolve()
},
delay,
options,
)
})

/**
Expand Down

0 comments on commit cab0ec6

Please sign in to comment.