Skip to content

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 typeFieldsWhen it is sent
ridge:readystateSchemaOnce, when the dashboard can receive state requests. Sent to the framing page before it has spoken; register your listener before loading the iframe.
ridge:staterequestId, stateIn response to ridge:getState, with the matching request id and complete state.
ridge:stateSchemarequestId, stateSchemaIn response to ridge:getStateSchema, with the matching request id.
ridge:stateChangestateAfter a user interaction or a state update without silent: true. Contains the complete resulting state.
ridge:errorerrorOnce 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.