source:
node_modules/es-toolkit/dist/compat/function/delay.mjs
| Last change on this file was a762898, checked in by , 5 months ago | |
|---|---|
|
|
| File size: 264 bytes | |
| Line | |
|---|---|
| 1 | import { toNumber } from '../util/toNumber.mjs'; |
| 2 | |
| 3 | function delay(func, wait, ...args) { |
| 4 | if (typeof func !== 'function') { |
| 5 | throw new TypeError('Expected a function'); |
| 6 | } |
| 7 | return setTimeout(func, toNumber(wait) || 0, ...args); |
| 8 | } |
| 9 | |
| 10 | export { delay }; |
Note:
See TracBrowser
for help on using the repository browser.
