requestAnimationFrame pauses execution automatically when the browser window loses focus. You can use a recursive setTimeout instead of a setInterval and encapsulate it in a requestAnimationFrame.
(function cleanGarbageLifecycle() {
requestAnimationFrame(function() {
setTimeout(function() {
cleanGarbage();
cleanGarbageLifecycle();
}, 3000);
});
})();