ealmansi/set-interval-async
### [`v2.0.0`](https://togithub.com/ealmansi/set-interval-async/releases/v2.0.0)
#### Breaking changes
##### **Error handling**
Errors thrown by the handler function passed in to `setIntervalAsync` are no longer hidden (swallowed). This will allow users of this library to more easily detect and handle failure within their handlers, which will now raise an `UnhandledPromiseRejectionWarning` if not handled by the application itself. If you wish to fall back to the previous behaviour, you may simply wrap your handlers in the following way:
```javascript
setIntervalAsync(async () => {
try {
await handler(); // the previous handler function which could potentially fail
} catch (err) {
console.error(err);
}
}, someInterval);
// or similarly,
setIntervalAsync(() => {
return Promise.resolve(handler()).catch((err) => console.error(err));
}, someInterval);
```
#### Bug fixes
##### Awaiting `clearIntervalAsync`
While `clearIntervalAsync` was still correctly clearing the execution interval, a bug in version v1.x.x was causing the promise returned by the function to be resolved prematurely before the interval was fully stopped. This bug has now been fixed, which means the following code should work as expected:
```javascript
it('should test something', async () => {
const timer = setIntervalAsync(...);
// Some assertions.
await clearIntervalAsync(timer);
// At this point, the interval has been cleared and all executions
// are guaranteed to have fully finished.
});
```
Renovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.
:recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
:no_bell: Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
1.0.34
->2.0.0
Release Notes
ealmansi/set-interval-async
### [`v2.0.0`](https://togithub.com/ealmansi/set-interval-async/releases/v2.0.0) #### Breaking changes ##### **Error handling** Errors thrown by the handler function passed in to `setIntervalAsync` are no longer hidden (swallowed). This will allow users of this library to more easily detect and handle failure within their handlers, which will now raise an `UnhandledPromiseRejectionWarning` if not handled by the application itself. If you wish to fall back to the previous behaviour, you may simply wrap your handlers in the following way: ```javascript setIntervalAsync(async () => { try { await handler(); // the previous handler function which could potentially fail } catch (err) { console.error(err); } }, someInterval); // or similarly, setIntervalAsync(() => { return Promise.resolve(handler()).catch((err) => console.error(err)); }, someInterval); ``` #### Bug fixes ##### Awaiting `clearIntervalAsync` While `clearIntervalAsync` was still correctly clearing the execution interval, a bug in version v1.x.x was causing the promise returned by the function to be resolved prematurely before the interval was fully stopped. This bug has now been fixed, which means the following code should work as expected: ```javascript it('should test something', async () => { const timer = setIntervalAsync(...); // Some assertions. await clearIntervalAsync(timer); // At this point, the interval has been cleared and all executions // are guaranteed to have fully finished. }); ```Renovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.
:recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
:no_bell: Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.