Embedded mode (iFrame)
The renderer can be embedded in other applications via an iFrame and controlled via it.
Window.postMessage is used for communication with the renderer in the iFrame. All Functions also send responses in this way to the application that embeds the renderer via iFrame.
Function call
A serialized JSON object is transmitted as message Parameters.
action-
Name of the function to be called.
payload-
Depending on the action, a Parameters object containing further data is specified via this attribute.
sourceId-
Freely selectable ID. This is transmitted as
destinationIdwhen the function result is transmitted. This allows the caller to uniquely assign the result.
{
"action" : "METHOD_NAME",
"sourceId": "SOURCE_ID",
"payload" : {
"_comment": "optional object depending on method"
}
}
Function result
The result of the function call is transmitted asynchronously via Window.postMessage to the embedding page.
{
"success" : "SUCCESS_OF_ACTION",
"action" : "METHOD_NAME",
"destinationId" : "SAME_AS_SOURCE_ID",
"response" : {
"_comment": "optional response object"
}
}
Functions
All actions valid in the Forms context can be used. For example:
{
"action" : "setFormState",
"payload" : {
"data" : { "welcomeMsg" : "Dies ist eine neue Nachricht" }
}
}
With the response that the function could be called successfully:
{
"success" : true,
"action" : "setFormState",
"destinationId" : "*",
"response": {}
}