onWindowMessage(event) {
    if (!isInTrustyOrigins(event.origin, this.trustyOrigins)) {
      this.log('Receive a message from an untrusted origin', {
        origin: event.origin,
        data: event.data,
      });
      return;
    }

    if (event.source !== window.parent) {
      this.log('Receive a message from non-parent window, including itself', {
        origin: event.origin,
        data: event.data,
      });
      return;
    }

    if (!this.parentOrigin) {
      this.parentOrigin = event.origin;
    }

    const deserializeData = deserialize(event.data);

    // Common API
    if (this.loose) {
      this.messageHandlers.forEach(handleMessage => {
        handleMessage(deserializeData, event);
      });
      return;
    }

    // New API for ReactIframe component
    const { header, body } = deserializeData;

    if (!header || header.isTrusted === undefined) {
      throw new Error(
        'Opps! Something went wrong, try setting `loose` property to `true`.'
      );
    }

    // The `header.isTrusted` is a boolean. It is true when the message was sent
    // by a user action, and false when the message was sent automatically by
    // ReactIframe component.
    if (header.isTrusted) {
      this.messageHandlers.forEach(handleMessage => {
        handleMessage(body, event);
      });
    } else {
      // TODO: process the message sent automatically by ReactIframe
    }
  }
/**
   * @private
   * Fired when the window receives a message.
   * @param {MessageEvent} event
   */
@private
Fired when the window receives a message.
@private Fired when the window receives a message .
onWindowMessage(event) {
    if (!isInTrustyOrigins(event.origin, this.trustyOrigins)) {
      this.log('Receive a message from an untrusted origin', {
        origin: event.origin,
        data: event.data,
      });
      return;
    }
    if (event.source !== window.parent) {
      this.log('Receive a message from non-parent window, including itself', {
        origin: event.origin,
        data: event.data,
      });
      return;
    }
    if (!this.parentOrigin) {
      this.parentOrigin = event.origin;
    }
    const deserializeData = deserialize(event.data);
    if (this.loose) {
      this.messageHandlers.forEach(handleMessage => {
        handleMessage(deserializeData, event);
      });
      return;
    }
    const { header, body } = deserializeData;
    if (!header || header.isTrusted === undefined) {
      throw new Error(
        'Opps! Something went wrong, try setting `loose` property to `true`.'
      );
    }
    if (header.isTrusted) {
      this.messageHandlers.forEach(handleMessage => {
        handleMessage(body, event);
      });
    } else {
    }
  }
onWindowMessage ( event ) { if ( ! isInTrustyOrigins ( event . origin , this . trustyOrigins ) ) { this . log ( 'Receive a message from an untrusted origin' , { origin : event . origin , data : event . data , } ) ; return ; } if ( event . source !== window . parent ) { this . log ( 'Receive a message from non-parent window, including itself' , { origin : event . origin , data : event . data , } ) ; return ; } if ( ! this . parentOrigin ) { this . parentOrigin = event . origin ; } const deserializeData = deserialize ( event . data ) ; if ( this . loose ) { this . messageHandlers . forEach ( handleMessage => { handleMessage ( deserializeData , event ) ; } ) ; return ; } const { header , body } = deserializeData ; if ( ! header || header . isTrusted === undefined ) { throw new Error ( 'Opps! Something went wrong, try setting `loose` property to `true`.' ) ; } if ( header . isTrusted ) { this . messageHandlers . forEach ( handleMessage => { handleMessage ( body , event ) ; } ) ; } else { } }
@private
 Fired when the window receives a message.
@private Fired when the window receives a message .
// Common API // New API for ReactIframe component // The `header.isTrusted` is a boolean. It is true when the message was sent // by a user action, and false when the message was sent automatically by // ReactIframe component. // TODO: process the message sent automatically by ReactIframe