Core SDK
Introduction
The Core SDK provides the fundamental methods for initializing and configuring the Maestro Web SDK. These methods serve as the entry point for integrating the SDK into your web application and allow you to authenticate users, manage event lifecycles, and render the Maestro panel.
SDK Entry Point
The Maestro Web SDK follows a singleton pattern, providing a single instance that you can import and use throughout your application:
import SDK from '@maestro_io/maestro-web-sdk';
Key Responsibilities
SDK Configuration:
Theconfigure()method initializes the SDK with your site ID, user authentication, and other required parameters. This is typically the first method you call when integrating the SDK.Event Lifecycle Management:
TheuserDidStartWatchingEvent()anduserDidStopWatchingEvent()methods manage the lifecycle of events, initializing necessary resources when a user starts watching an event and cleaning up when they stop.UI Rendering:
TherenderPanel()method renders the Maestro panel UI into a specified DOM element, returning an unmount function that can be called to remove the UI when needed.View Model Access:
ThegetMaestroEventViewModel()method provides access to the event view model, which contains methods and properties for interacting with the current event.
Methods
| Method | Description |
|---|---|
| configure() | Initializes the Maestro Web SDK with required configuration parameters. |
| getMaestroEventViewModel() | Retrieves the current event view model instance. |
| renderPanel() | Renders the Maestro panel UI into a specified DOM element. |
| userDidStartWatchingEvent() | Indicates that a user has started watching an event and initializes the event view model. |
| userDidStopWatchingEvent() | Indicates that a user has stopped watching an event and cleans up resources. |