postMessage
Sends a message to the UI's <iframe>
window.
Signature
postMessage(pluginMessage: any, options?: UIPostMessageOptions): void
Parameters
pluginMessage
This can be almost any data type or plain object, as long as it's a serializable object.
This is similar to saying that it should be possible to send the object over a network if it were necessary. You can send objects, arrays, numbers, strings, booleans, null, undefined, Date objects and Uint8Array objects. However, functions and prototype chains of objects will not be sent.
These restrictions are the same as the browser's postMessage
: click here for more details.
options
An object that may contain the following optional parameters:
origin
: An advanced option, mainly used for implementing OAuth. If theorigin
option is provided, the message will only be delivered to the iframe if the origin of the document inside the iframe matches theorigin
. This defaults to'*'
, which allows the message to be passed to any document.
Remarks
Read more about how to use this API in the Creating a User Interface tutorial.