src/components/activities.js
/**
   * Waits until the activity port is connected to the host.
   * @return {!Promise}
   */
Waits until the activity port is connected to the host.
@return {!Promise}
Waits until the activity port is connected to the host . @return { !Promise }
connect() {
    return this.iframePort_.connect().then(() => {
      this.iframePort_.onMessage((data) => {
        const response = data && data['RESPONSE'];
        if (!response) {
          return;
        }
        const cb = this.callbackMap_[response[0]];
        if (cb) {
          cb(deserialize(response));
        }
      });
      if (this.deps_ && this.deps_.eventManager()) {
        this.on(AnalyticsRequest, (request) => {
          const analyticsRequest =  (request);
          this.deps_.eventManager().logEvent({
            eventType: analyticsRequest.getEvent(),
            eventOriginator: EventOriginator.SWG_SERVER,
            isFromUserAction: analyticsRequest.getMeta().getIsFromUserAction(),
            additionalParameters: analyticsRequest.getParams(),
          });
        });
      }
    });
  }
connect ( ) { return this . iframePort_ . connect ( ) . then ( ( ) => { this . iframePort_ . onMessage ( ( data ) => { const response = data && data [ 'RESPONSE' ] ; if ( ! response ) { return ; } const cb = this . callbackMap_ [ response [ 0 ] ] ; if ( cb ) { cb ( deserialize ( response ) ) ; } } ) ; if ( this . deps_ && this . deps_ . eventManager ( ) ) { this . on ( AnalyticsRequest , ( request ) => { const analyticsRequest = ( request ) ; this . deps_ . eventManager ( ) . logEvent ( { eventType : analyticsRequest . getEvent ( ) , eventOriginator : EventOriginator . SWG_SERVER , isFromUserAction : analyticsRequest . getMeta ( ) . getIsFromUserAction ( ) , additionalParameters : analyticsRequest . getParams ( ) , } ) ; } ) ; } } ) ; }
Waits until the activity port is connected to the host.
Waits until the activity port is connected to the host .
// Attach a callback to receive messages after connection complete /** @type {AnalyticsRequest} */