Hello Emmanuel, here's a pretty simple implementation of what you might consider doing // Define a global variable to keep track of when this window is in focus var windowFocused = true ; // Change the value of the windowFocused variable when the window is no longer in focus window .addEventListener( 'blur' , function ( ) { windowFocused = false ; }, false ); // Change the value of the windowFocused variable when the window is in focus window .addEventListener( 'focus' , function ( ) { windowFocused = true ; }, false ); // Your setInterval() function setInterval( function ( ) { if (windowFocused) { // Carry out your tasks here console .log( 'Window focused: ' , windowFocused); } }, 1000 );