function _handlePostMessage(event) {
            if (event.data) {
                var data;
                try {
                    data = JSON.parse(event.data);
                } catch(err) {
                    return console.log(
                        'iframeMessenger: Error parsing data. ' + err.toString()
                    );
                }

                // Check postmessage is exptected 
                if (data.hasOwnProperty('id') &&
                    _postMessageCallbacks.hasOwnProperty(data.id))
                {
                    // Run callback with data a clean up afterwards
                    _postMessageCallbacks[data.id](data);
                    delete _postMessageCallbacks[data.id];
                }
            }
        }
/**
         * Handle postMessage response and trigger callback with data.
         * @param  {object} event Post message event object
         */
Handle postMessage response and trigger callback with data.
@param  {object} event Post message event object
Handle postMessage response and trigger callback with data . @param { object } event Post message event object
function _handlePostMessage(event) {
            if (event.data) {
                var data;
                try {
                    data = JSON.parse(event.data);
                } catch(err) {
                    return console.log(
                        'iframeMessenger: Error parsing data. ' + err.toString()
                    );
                }
                if (data.hasOwnProperty('id') &&
                    _postMessageCallbacks.hasOwnProperty(data.id))
                {
                    _postMessageCallbacks[data.id](data);
                    delete _postMessageCallbacks[data.id];
                }
            }
        }
function _handlePostMessage ( event ) { if ( event . data ) { var data ; try { data = JSON . parse ( event . data ) ; } catch ( err ) { return console . log ( 'iframeMessenger: Error parsing data. ' + err . toString ( ) ) ; } if ( data . hasOwnProperty ( 'id' ) && _postMessageCallbacks . hasOwnProperty ( data . id ) ) { _postMessageCallbacks [ data . id ] ( data ) ; delete _postMessageCallbacks [ data . id ] ; } } }
Handle postMessage response and trigger callback with data.
Handle postMessage response and trigger callback with data .
// Check postmessage is exptected  // Run callback with data a clean up afterwards