_setupVisibility() {
    if (Properties.isFriendlyIframe) {
      _hiddenProp = 'mraid_viewable';

      window.addEventListener('message', e => {
        let message = e.data || e.originalEvent.data;
        if (message.event === 'viewableChange') {
          document[_hiddenProp] = !message.value; // visibility API based on "is hidden", mraid based on "is viewable"
          this._handlePageVisibilityChange();
        }
      });

      return;
    }

    // so many vendor prefixes...
    if (typeof document.hidden !== 'undefined') {
      _hiddenProp = 'hidden';
      document.addEventListener(
        'visibilitychange',
        this._handlePageVisibilityChange.bind(this)
      );
    } else if (typeof document.mozHidden !== 'undefined') {
      _hiddenProp = 'mozHidden';
      document.addEventListener(
        'mozvisibilitychange',
        this._handlePageVisibilityChange.bind(this)
      );
    } else if (typeof document.msHidden !== 'undefined') {
      _hiddenProp = 'msHidden';
      document.addEventListener(
        'msvisibilitychange',
        this._handlePageVisibilityChange.bind(this)
      );
    } else if (typeof document.webkitHidden !== 'undefined') {
      _hiddenProp = 'webkitHidden';
      document.addEventListener(
        'webkitvisibilitychange',
        this._handlePageVisibilityChange.bind(this)
      );
    }
  }
/**
   * Sets up visibility event handlers depending on which browser/environment we are in.
   * @private
   * @returns {void}
   */
Sets up visibility event handlers depending on which browser/environment we are in.
@private
@returns {void}
Sets up visibility event handlers depending on which browser / environment we are in . @private @returns { void }
_setupVisibility() {
    if (Properties.isFriendlyIframe) {
      _hiddenProp = 'mraid_viewable';
      window.addEventListener('message', e => {
        let message = e.data || e.originalEvent.data;
        if (message.event === 'viewableChange') {
          document[_hiddenProp] = !message.value; 
          this._handlePageVisibilityChange();
        }
      });
      return;
    }
    if (typeof document.hidden !== 'undefined') {
      _hiddenProp = 'hidden';
      document.addEventListener(
        'visibilitychange',
        this._handlePageVisibilityChange.bind(this)
      );
    } else if (typeof document.mozHidden !== 'undefined') {
      _hiddenProp = 'mozHidden';
      document.addEventListener(
        'mozvisibilitychange',
        this._handlePageVisibilityChange.bind(this)
      );
    } else if (typeof document.msHidden !== 'undefined') {
      _hiddenProp = 'msHidden';
      document.addEventListener(
        'msvisibilitychange',
        this._handlePageVisibilityChange.bind(this)
      );
    } else if (typeof document.webkitHidden !== 'undefined') {
      _hiddenProp = 'webkitHidden';
      document.addEventListener(
        'webkitvisibilitychange',
        this._handlePageVisibilityChange.bind(this)
      );
    }
  }
_setupVisibility ( ) { if ( Properties . isFriendlyIframe ) { _hiddenProp = 'mraid_viewable' ; window . addEventListener ( 'message' , e => { let message = e . data || e . originalEvent . data ; if ( message . event === 'viewableChange' ) { document [ _hiddenProp ] = ! message . value ; this . _handlePageVisibilityChange ( ) ; } } ) ; return ; } if ( typeof document . hidden !== 'undefined' ) { _hiddenProp = 'hidden' ; document . addEventListener ( 'visibilitychange' , this . _handlePageVisibilityChange . bind ( this ) ) ; } else if ( typeof document . mozHidden !== 'undefined' ) { _hiddenProp = 'mozHidden' ; document . addEventListener ( 'mozvisibilitychange' , this . _handlePageVisibilityChange . bind ( this ) ) ; } else if ( typeof document . msHidden !== 'undefined' ) { _hiddenProp = 'msHidden' ; document . addEventListener ( 'msvisibilitychange' , this . _handlePageVisibilityChange . bind ( this ) ) ; } else if ( typeof document . webkitHidden !== 'undefined' ) { _hiddenProp = 'webkitHidden' ; document . addEventListener ( 'webkitvisibilitychange' , this . _handlePageVisibilityChange . bind ( this ) ) ; } }
Sets up visibility event handlers depending on which browser/environment we are in.
Sets up visibility event handlers depending on which browser / environment we are in .
// visibility API based on "is hidden", mraid based on "is viewable" // so many vendor prefixes...