-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Is your feature request related to a problem? Please describe.
I am using browser to run an app, where browser most of the time stays unfocused. My app uses timeouts, and I require those timeouts to not be throttled by unfocused browser. When browser is unfocused, even 1 second timeout may never finish, until browser gets focused again.
For this purpose, I use setTimeout from worker-timers.
However, I run into a pattern where I sometimes require "wait until" pattern to be used. For that, I've chosen, to use this library. But unfortunately this library doesn't have an option to run timeouts using web workers.
Describe the solution you'd like
An option to indicate, to run timeouts (both options.timeout and options.intervalBetweenAttempts) using web workers. Perhaps an option such as passing options.useWorkerTimeout: boolean could be used, where false (default value) would indicate to run native timeout, and true would indicate to run using worker timeout.
As for implementation, you could choose to use worker-timers library.
Describe alternatives you've considered
Not using this library, and implementing waitUntil myself to use web worker timeouts. However, I thought someone else may benefit if this was part of the library.