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

    Function newApplet

    • Initialise a new Applet<Msg, Params> instance.

      Dynamically creates either a BoxApplet<Msg, Params> or a ClientApplet<Msg, Params> depending on the environment.

      • The generic Msg should be set to the type of the applet-messages to send and receive between.
      • The optional generic Params should be set to the type of the custom parameters that were passed to the applet on start. (from the startApplet message).

      The applet.isBox or applet.isClient fields can be used to narrow the type of applet.

      Type Parameters

      • Msg
      • Params extends BaseParams = never

      Parameters

      • Optionalopts: AppletOptions

        The initialisation options.

        • Optionallog?: boolean

          Whether the SDK should log out verbose messaging for this applet.

      Returns Promise<Applet<Msg, Params>>

      const applet = await sdk.newApplet<Msg, Params>();
      if (applet.isBox) {
      // applet has typeof BoxApplet<Msg, Params>
      } else {
      // applet has typeof ClientApplet<Msg, Params>
      }