app/scripts/inpage.js
/**
 * Adds a postMessage listener for a specific message type
 *
 * @param {string} messageType - postMessage type to listen for
 * @param {Function} handler - event handler
 * @param {boolean} remove - removes this handler after being triggered
 */
Adds a postMessage listener for a specific message type
@param {string} messageType - postMessage type to listen for
@param {Function} handler - event handler
@param {boolean} remove - removes this handler after being triggered
Adds a postMessage listener for a specific message type @param { string } messageType - postMessage type to listen for @param { Function } handler - event handler @param { boolean } remove - removes this handler after being triggered
function onMessage (messageType, callback, remove) {
  const handler = function ({ data }) {
    if (!data || data.type !== messageType) { return }
    remove && window.removeEventListener('message', handler)
    callback.apply(window, arguments)
  }
  window.addEventListener('message', handler)
}
function onMessage ( messageType , callback , remove ) { const handler = function ( { data } ) { if ( ! data || data . type !== messageType ) { return } remove && window . removeEventListener ( 'message' , handler ) callback . apply ( window , arguments ) } window . addEventListener ( 'message' , handler ) }
Adds a postMessage listener for a specific message type
 @param {string} messageType - postMessage type to listen for
 @param {Function} handler - event handler
 @param {boolean} remove - removes this handler after being triggered
Adds a postMessage listener for a specific message type @param { string } messageType - postMessage type to listen for @param { Function } handler - event handler @param { boolean } remove - removes this handler after being triggered