I guess this is because browser suddenly decides to pause tab's main thread. We cannot control this. But instead, we can use web workers and they will work at background. So, try to move your timer to web worker