I have a simple timer observable which is subscribed to when a timer starts in my app. It works well, but if another browser tab is selected then the timer stops until the app's tab is selected again.
public timer = Observable
.interval(100)
Is there a way I can keep the observable running while the tab is in the background?
Update
I looked briefly into running this as a Web Worker, but soon started reading about difficulties of integrating Web Workers into Angular projects.
So for the time being I'm using the simple solution of getting the start time of my timer and subtracting that from the current time to get the timer run duration. This way the timer will correct itself when when the tab becomes active again.
I did want the page title to display the timer count so that it can be seen just by looking at the tab, so I'd still like to find a better solution to this problem.