You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Historically, functions scheduled with `betterSetInterval` needed to
accept a callback and then call it when done, to schedule their next
invocation. This was because Promises were not a thing in 2015 when this
function was originally written. It's silly to have this requirement
now, almost ten years later, when async/await and Promises are a normal
feature.
This change adds support for scheduling any function, sync or async,
accepting or not accepting a callback, and having it just work.
```js
betterSetInterval(async () => {
await myAsyncOperation();
}, 1000);
```
For backwards compatibility reasons, a dummy callback is still passed to
the invoked function as its first argument, otherwise the functions that
don't expect this change would break.
0 commit comments