Appearance
Type Alias: EmbedToHostMessage
ts
type EmbedToHostMessage =
| {
requestId: string;
state: StateValues;
type: typeof state;
}
| {
requestId: string;
stateSchema: StateSchema;
type: typeof stateSchema;
}
| {
state: StateValues;
type: typeof stateChange;
}
| {
stateSchema: StateSchema;
type: typeof ready;
}
| {
error: StateError;
type: typeof error;
};Messages an iframe sends to your app through the window's message event. Check event.origin and event.source before reading the payload.
Message type | Fields | When it is sent |
|---|---|---|
ridge:ready | stateSchema | Once, when the dashboard can receive state requests. Sent to the framing page before it has spoken; register your listener before loading the iframe. |
ridge:state | requestId, state | In response to ridge:getState, with the matching request id and complete state. |
ridge:stateSchema | requestId, stateSchema | In response to ridge:getStateSchema, with the matching request id. |
ridge:stateChange | state | After a user interaction or a state update without silent: true. Contains the complete resulting state. |
ridge:error | error | Once per rejected component update. Contains its component id, error code, and message. |
The state schema describes accepted values and write permissions. A state change message contains the current values, with unset keys omitted. Error messages can occur even when other updates in the same batch succeed.