code: function() {
        // only flush if the page is visibile
        if (document.visibilityState === 'hidden') {
          if (scope.flushPoll) {
            clearInterval(scope.flushPoll);
          }
        } else {
          scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL);
        }
      }
docs: watch document visiblity to toggle dirty-checking