src/core/3p-frame-messaging.js
/**
 * Serialize an AMP post message. Output looks like:
 * 'amp-011481323099490{"type":"position","sentinel":"12345","foo":"bar"}'
 * @param {string} type
 * @param {string} sentinel
 * @param {JsonObject=} data
 * @param {?string=} rtvVersion
 * @return {string}
 */
Serialize an AMP post message.
Serialize an AMP post message .
function serializeMessage(
  type,
  sentinel,
  data = dict(),
  rtvVersion = null
) {
  const message = data;
  message['type'] = type;
  message['sentinel'] = sentinel;
  return AMP_MESSAGE_PREFIX + (rtvVersion || '') + JSON.stringify(message);
}
function serializeMessage ( type , sentinel , data = dict ( ) , rtvVersion = null ) { const message = data ; message [ 'type' ] = type ; message [ 'sentinel' ] = sentinel ; return AMP_MESSAGE_PREFIX + ( rtvVersion || '' ) + JSON . stringify ( message ) ; }
Serialize an AMP post message.
Serialize an AMP post message .
// TODO: consider wrap the data in a "data" field. { type, sentinal, data }