onSDKEvent
Receives general SDK-to-host events.
Overview
Implement onSDKEvent in your delegate to receive events that the SDK sends to the host outside of the panel and overlay event channels. This method is optional — hosts that do not implement it simply do not receive these events and can rely on getAvailablePanels() to pull the panel list on demand instead.
The SDK currently sends one event type on this callback: rendered:channels, which reports the available panel list once it is ready and again whenever it changes.
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 | MaestroPanelType[] | The available panel types in tab order, matching getAvailablePanels() by type. 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. |
Example
import {
IMaestroEventDelegate,
SDKEvent,
RenderedChannelsSDKEvent,
} 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);
}
}
// ... 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. - Both
SDKEventandRenderedChannelsSDKEventare exported from@maestro_io/maestro-web-sdk.