chrisguttandin / audio-context-timers

A replacement for setInterval() and setTimeout() which works in unfocused windows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is the difference between Worker Timers and Audio Context Timers?

KVPasupuleti opened this issue · comments

Both the packages serve the same purpose. But, why two?

Is there any advantage of using one over the other?

@chrisguttandin

Please let me know.

Hi @KVPasupuleti,

I initially created worker-timers to keep a timer (setTimeout/setInterval) running on pages which are not visible. At some point Chrome changed the behavior and also throttled workers. I therefore came up with this package which apparently worked at that time.

Some time later the changes in Chrome got reverted and worker-timers worked again. Afterwards autoplay mechanisms were added to almost all browsers which means that this package doesn't work anymore unless the AudioContext is allowed to start.

Both packages use undocumented implementation specific browser behavior. Sometimes they work, sometimes they don't. :-(