extensions/amp-analytics/0.1/events.js
/**
   * Returns a Promise indicating that we're ready to report the analytics,
   * in the case of reportWhen: documentHidden
   * @return {!Promise}
   * @private
   */
Returns a Promise indicating that we're ready to report the analytics,
in the case of reportWhen: documentHidden
@return {!Promise}
@private
Returns a Promise indicating that we ' re ready to report the analytics in the case of reportWhen : documentHidden @return { !Promise } @private
createReportReadyPromiseForDocumentHidden_() {
    const viewer = this.root.getViewer();
    if (!viewer.isVisible()) {
      return Promise.resolve();
    }
    return new Promise(resolve => {
      viewer.onVisibilityChanged(() => {
        if (!viewer.isVisible()) {
          resolve();
        }
      });
    });
  }
createReportReadyPromiseForDocumentHidden_ ( ) { const viewer = this . root . getViewer ( ) ; if ( ! viewer . isVisible ( ) ) { return Promise . resolve ( ) ; } return new Promise ( resolve => { viewer . onVisibilityChanged ( ( ) => { if ( ! viewer . isVisible ( ) ) { resolve ( ) ; } } ) ; } ) ; }
Returns a Promise indicating that we're ready to report the analytics,
 in the case of reportWhen: documentHidden
 @return {!Promise}
 @private
Returns a Promise indicating that we ' re ready to report the analytics in the case of reportWhen : documentHidden @return { !Promise } @private