Pausing a setInterval function's execution when the page isn't in view
Is there a way to pause a function's execution when a user leaves a page? eg if I have something like: setInterval(cleanGarbage, 3000); Is there a way to pause it when the user switches his/her tab to a different page, so the function doesn't keep r...