_handlePageVisibilityChange() {
    let now = Date.now(),
      isHidden = document[_hiddenProp]; // normalizing vendor prefixes; see _initializeOnce function

    Logger.info(`visibility changed: ${isHidden ? 'hidden' : 'visible'}`);

    if (isHidden) {
      if (_isUnloaded) {
        return;
      } // sometimes we get notifications for losing visiblity *and* beforeunload; only fire once

      _isUnloaded = true;
      this._pauseSessionMonitor();

      VideoMetrics.runUnloadEvents();
      this.fireContentPageConsumed(Router.currentRoute);
      this.fireUserSession();

      _userSession.hiddenAt = now;
      Storage.setItem('hiddenAt', now);
    } else {
      _isUnloaded = false;

      _userSession.totalHiddenDuration += now - _userSession.hiddenAt;

      Storage.removeItem('hiddenAt');

      this._runSessionMonitor();
    }
  }
/**
   * Fires when the page visibility changes (for instance, a tab is backgrounded or brought back to the foreground).
   * @private
   * @returns {void}
   */
Fires when the page visibility changes (for instance, a tab is backgrounded or brought back to the foreground).
@private
@returns {void}
Fires when the page visibility changes ( for instance a tab is backgrounded or brought back to the foreground ) . @private @returns { void }
_handlePageVisibilityChange() {
    let now = Date.now(),
      isHidden = document[_hiddenProp]; 
    Logger.info(`visibility changed: ${isHidden ? 'hidden' : 'visible'}`);
    if (isHidden) {
      if (_isUnloaded) {
        return;
      } 
      _isUnloaded = true;
      this._pauseSessionMonitor();
      VideoMetrics.runUnloadEvents();
      this.fireContentPageConsumed(Router.currentRoute);
      this.fireUserSession();
      _userSession.hiddenAt = now;
      Storage.setItem('hiddenAt', now);
    } else {
      _isUnloaded = false;
      _userSession.totalHiddenDuration += now - _userSession.hiddenAt;
      Storage.removeItem('hiddenAt');
      this._runSessionMonitor();
    }
  }
_handlePageVisibilityChange ( ) { let now = Date . now ( ) , isHidden = document [ _hiddenProp ] ; Logger . info ( ` ${ isHidden ? 'hidden' : 'visible' } ` ) ; if ( isHidden ) { if ( _isUnloaded ) { return ; } _isUnloaded = true ; this . _pauseSessionMonitor ( ) ; VideoMetrics . runUnloadEvents ( ) ; this . fireContentPageConsumed ( Router . currentRoute ) ; this . fireUserSession ( ) ; _userSession . hiddenAt = now ; Storage . setItem ( 'hiddenAt' , now ) ; } else { _isUnloaded = false ; _userSession . totalHiddenDuration += now - _userSession . hiddenAt ; Storage . removeItem ( 'hiddenAt' ) ; this . _runSessionMonitor ( ) ; } }
Fires when the page visibility changes (for instance, a tab is backgrounded or brought back to the foreground).
Fires when the page visibility changes ( for instance a tab is backgrounded or brought back to the foreground ) .
// normalizing vendor prefixes; see _initializeOnce function // sometimes we get notifications for losing visiblity *and* beforeunload; only fire once