@viviedu/applet-sdk
    Preparing search index...

    Interface BaseApplet<Msg, Params>Abstract

    The base class for both BoxApplet and ClientApplet, containing shared methods and attributes.

    Abstract class, cannot be instantiated, instead use newApplet, newBoxApplet, or newClientApplet.

    interface BaseApplet<Msg, Params extends BaseParams = never> {
        customParams: Params | undefined;
        get _debug(): { features: string[]; mode: "control" | "signage" };
        listen(listener: Listener<Msg>): () => void;
        send(message: Msg): Promise<void>;
    }

    Type Parameters

    • Msg
    • Params extends BaseParams = never

    Hierarchy (View Summary)

    Index

    Properties

    Accessors

    Methods

    Properties

    customParams: Params | undefined

    The params that were passed (custom_params) when starting the applet.

    Accessors

    • get _debug(): { features: string[]; mode: "control" | "signage" }

      Properties exposed specifically for debugging purposes only

      Caution

      The contents, structure and existence of _debug are not stable, backwards-compatible or guaranteed. Do not use for business logic.

      Returns { features: string[]; mode: "control" | "signage" }

    Methods

    • Add a listener for any incoming messages sent from other applet instances.

      The message will be of type Msg that the user defines. (eg: Applet<Msg>)

      Parameters

      • listener: Listener<Msg>

        The listener function that will be called when a message is received.

      Returns () => void

      A callback to remove the listener

    • Send an message of type Msg to other applet instances.

      Will reject if the message was not successfully sent.

      Parameters

      • message: Msg

        The message to be sent

      Returns Promise<void>