onSDKEvent
Receives general SDK-to-host events.
Method Signature
onSDKEvent?(event: SDKEvent): void
Parameters
| Parameter | Type | Description |
|---|---|---|
event | SDKEvent | The SDK event. Discriminate on event.type to handle each event type. |
Return Value
This method does not return a value.
Events
rendered:channels
Emitted once the page configs are parsed and the panel list is set — before renderPanel is called — and again whenever the list changes. Changes that trigger a new emission include a panel being hidden through updateUserSettings or an event being added or removed in a multi-event session. Identical republishes are skipped.
The payload type is RenderedChannelsSDKEvent['payload']:
| Field | Type | Description |
|---|---|---|
panels | PanelType[] | The available panel types in tab order, matching getAvailablePanels() by type. Each entry is either a MaestroPanelType constant (for built-in panels) or a config-defined type string (for config-driven panels). Empty when the page has no panels. |
eventMetaData | Record<string, PageMetadata> | Each loaded page's metadata, keyed by the page's event ID (external_field_1). Pages without an external_field_1, or whose config failed to load, are absent. |
panel-layout:failed
Emitted when a designed panel's layout cannot be drawn. The panel is excluded from the tab strip and from getAvailablePanels(); all other panels are unaffected. The SDK emits this event before sending rendered:channels, so the first rendered:channels payload already reflects the exclusion.
The payload type is PanelLayoutFailedSDKEvent['payload']:
| Field | Type | Description |
|---|---|---|
panelType | string | The panel type whose layout could not be drawn. |
reason | 'failed' \| 'nothingToDraw' \| 'timeout' | Why the layout was not drawn. failed: the layout file could not be downloaded, did not match its hash, or did not parse. nothingToDraw: no layout is published for this panel type. timeout: the layout was still loading when the tab strip settled. |
url | string \| null | The layout file URL the page config points at, or null if none was configured. |
Example
import {
IMaestroEventDelegate,
SDKEvent,
RenderedChannelsSDKEvent,
PanelLayoutFailedSDKEvent,
} from "@maestro_io/maestro-web-sdk";
class MyDelegate implements IMaestroEventDelegate {
onSDKEvent(event: SDKEvent): void {
if (event.type === "rendered:channels") {
const { panels, eventMetaData } =
(event as RenderedChannelsSDKEvent).payload;
// Build or update breakout buttons for each available panel.
renderBreakoutButtons(panels);
} else if (event.type === "panel-layout:failed") {
const { panelType, reason, url } =
(event as PanelLayoutFailedSDKEvent).payload;
console.warn(`Panel "${panelType}" excluded — layout ${reason}:`, url);
}
}
// ... other required delegate methods
}
Notes
onSDKEventis optional. Hosts that do not implement it can usegetAvailablePanels()to pull the panel list synchronously afteruserDidStartWatchingEventresolves.- The
SDKEventtype is a discriminated union. Narrow onevent.typebefore accessingevent.payloadto ensure type safety as new event types are added. SDKEvent,RenderedChannelsSDKEvent, andPanelLayoutFailedSDKEventare all exported from@maestro_io/maestro-web-sdk.