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';

SDK Interface

interface IMaestroManager {
/**
* Configures the SDK with required parameters
*/
configure(configParams: SDKConfigParams): void;

/**
* Indicates that a user has started watching an event
*/
userDidStartWatchingEvent(eventID: string, delegate: IMaestroEventDelegate): Promise<IMaestroEvent>;

/**
* Indicates that a user has stopped watching an event
*/
userDidStopWatchingEvent(eventID: string): void;

/**
* Renders the Maestro panel into a specified DOM element
*/
renderPanel(id: string): Promise<() => void>;

/**
* Gets the current event view model
*/
getMaestroEventViewModel(): MaestroEventViewModel;
}

Table of Contents

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.