Update API data docs.
parent
df1fa80ff6
commit
8595053d28
|
@ -19,16 +19,18 @@ Listens for incoming postMessage requests from embedded widgets. The following A
|
||||||
{
|
{
|
||||||
api: "widget",
|
api: "widget",
|
||||||
action: "content_loaded",
|
action: "content_loaded",
|
||||||
|
widgetId: $WIDGET_ID,
|
||||||
|
data: {}
|
||||||
// additional request fields
|
// additional request fields
|
||||||
widgetId: $WIDGET_ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
The complete request object is returned to the caller with an additional "response" key like so:
|
The complete request object is returned to the caller with an additional "response" key like so:
|
||||||
{
|
{
|
||||||
api: "widget",
|
api: "widget",
|
||||||
action: "content_loaded",
|
action: "content_loaded",
|
||||||
|
widgetId: $WIDGET_ID,
|
||||||
|
data: {},
|
||||||
// additional request fields
|
// additional request fields
|
||||||
widgetId: $WIDGET_ID
|
|
||||||
response: { ... }
|
response: { ... }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +38,8 @@ The "api" field is required to use this API, and must be set to "widget" in all
|
||||||
|
|
||||||
The "action" determines the format of the request and response. All actions can return an error response.
|
The "action" determines the format of the request and response. All actions can return an error response.
|
||||||
|
|
||||||
|
Additional data can be sent as additional, abritrary fields. However, typically the data object should be used.
|
||||||
|
|
||||||
A success response is an object with zero or more keys.
|
A success response is an object with zero or more keys.
|
||||||
|
|
||||||
An error response is a "response" object which consists of a sole "error" key to indicate an error.
|
An error response is a "response" object which consists of a sole "error" key to indicate an error.
|
||||||
|
@ -209,6 +213,7 @@ function onMessage(event) {
|
||||||
const action = event.data.action;
|
const action = event.data.action;
|
||||||
const widgetId = event.data.widgetId;
|
const widgetId = event.data.widgetId;
|
||||||
if (action === 'content_loaded') {
|
if (action === 'content_loaded') {
|
||||||
|
console.warn("Widget content loaded", widgetId);
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'widget_content_loaded',
|
action: 'widget_content_loaded',
|
||||||
widgetId: widgetId,
|
widgetId: widgetId,
|
||||||
|
|
Loading…
Reference in New Issue