I have an application with server requests to detect when something has happened, at which point it sets a countdown to something happening. If I have the app opened on multiple tabs/devices, they all get the event at the same time, but their countdowns differ in length. Is there a way to fix this?
I saw elsewhere that setInterval only calls the function if the tab is active, does $interval work similarly? All tabs seem to still get updated without being active, just at slightly (5-10%) different rates.
I was considering instead of starting a countdown that the application saves the current Date and then does a very fast interval constantly checking if the proper time has elapsed since that date, but that seems computationally intensive, though the rest of the application is lightweight so that wouldn't be a problem per se.
The interval itself is super fast/simple:
countdownTimer = $interval(function () {
$scope.countdown--;
}, 1000);