third_party/gpay/src/pay_frame_helper.js
/**
   * Sends a message to the iframe and wait for a response.
   * Uses the responseHandler specified only if the responseType is a match.
   *
   * @param {!Object} data
   * @param {!PostMessageEventType} eventType
   * @param {string} responseType
   * @param {function(!Event)} responseHandler
   */
Sends a message to the iframe and wait for a response.
Uses the responseHandler specified only if the responseType is a match.


Sends a message to the iframe and wait for a response . Uses the responseHandler specified only if the responseType is a match .
static sendAndWaitForResponse(
      data, eventType, responseType, responseHandler) {
    function callback(event) {
      if (event.data[responseType]) {
        responseHandler(event);
        PayFrameHelper.removeMessageEventListener_(callback);
      }
    }
    PayFrameHelper.addMessageEventListener_(callback);
    const postMessageData = Object.assign({'eventType': eventType}, data);
    PayFrameHelper.postMessage(postMessageData);
  }
static sendAndWaitForResponse ( data , eventType , responseType , responseHandler ) { function callback ( event ) { if ( event . data [ responseType ] ) { responseHandler ( event ) ; PayFrameHelper . removeMessageEventListener_ ( callback ) ; } } PayFrameHelper . addMessageEventListener_ ( callback ) ; const postMessageData = Object . assign ( { 'eventType' : eventType } , data ) ; PayFrameHelper . postMessage ( postMessageData ) ; }
Sends a message to the iframe and wait for a response.
Sends a message to the iframe and wait for a response .
// We only want to process the response from the payframe once. // so stop listening to the event once processed.