Class FusePlugin<TAPIOpts>Abstract

Base class for Fuse Plugins

Type Parameters

  • TAPIOpts = unknown

Hierarchy (view full)

Constructors

Methods

  • Creates a callback context that can be passed to native The native code can use the callbackID to callback to the JS code.

    The callback can be used several times.

    Release the callback using _releaseCallback with the given callbackID. These API usages should be part of your plugin API. When releasing a callback, a standard API call should be made to your plugin to tell the native side that the callback is no longer usable, and it should clean up the native resources surrounding the callback context.

    Note that callback data payloads only supports strings.

    Parameters

    Returns string

    String - callbackID

  • The execution API. Concrete classes can call this to perform calls to the native side.

    The concrete class should expose public methods with type information exposed.

    Parameters

    • method: string

      The method link, this should match the endpoint defined in the native API.

    • OptionalcontentType: string

      the MIME type of the data you are passing in.

    • Optionaldata: TSerializable

      The data to pass to the native environment

    • OptionalapiOpts: TAPIOpts

    Returns Promise<FuseAPIResponse>

    The response body from native. FuseResponseReader has some utility methods to read the data in common formats (e.g. text or JSON)

  • TAPIOpts is a plugin generic type declaring options. User may use this to declare a path on how to get a particular FuseAPI.

    This API may be overridden by subclasses to utilise the given options. The default implementation is to simply return a standard FuseAPI.

    Parameters

    Returns FuseAPI

  • Returns string

    Concrete classes should implement and return a string that uniquely represents this plugin. The string must conform to URL fragment rules. It shall only contain the following characters:

    • Alphabetical letters
    • Numbers
    • dots and hyphens
  • Releases a created callback.

    Parameters

    • id: string

      callbackID

    • OptionalapiOpts: TAPIOpts

    Returns void