Skip to main content

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:
    The configure() 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:
    The userDidStartWatchingEvent() and userDidStopWatchingEvent() methods manage the lifecycle of events, initializing necessary resources when a user starts watching an event and cleaning up when they stop.

  • UI Rendering:
    The renderPanel() 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:
    The getMaestroEventViewModel() method provides access to the event view model, which contains methods and properties for interacting with the current event.

Methods

MethodDescription
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.