Skip to content

Type Alias: HostToEmbedMessage ​

ts
type HostToEmbedMessage = 
  | {
  silent?: boolean;
  state: StateValues;
  type: typeof setState;
}
  | {
  requestId: string;
  type: typeof getState;
}
  | {
  requestId: string;
  type: typeof getStateSchema;
};

Messages your app sends to an iframe with frame.contentWindow.postMessage(message, ridgeOrigin). Wait for ridge:ready before sending requests. Use the iframe's exact origin as the target. The iframe addresses its replies and events to the origin of your first message, so send one command after ridge:ready even if your app only listens.

Message typeFieldsBehavior
ridge:setStatestate, optional silentMerge values by component id and state key. null clears a key. Omitted values remain unchanged.
ridge:getStaterequestIdRequest the current dashboard state. The reply is ridge:state.
ridge:getStateSchemarequestIdRequest the available state keys, schemas, and write permissions. The reply is ridge:stateSchema.

Choose a unique requestId for each read and match it to the reply. ridge:setState has no direct reply. Rejected updates produce ridge:error messages; other updates in the same batch may succeed. Set silent: true to suppress the resulting ridge:stateChange notification. Validation and error reporting still apply.

Example ​

ts
const message: HostToEmbedMessage = {
  type: "ridge:setState",
  state: { "region-menu": { filter: "EMEA" } },
  silent: true
};