Interface ActionService

The ActionService provides access to map-actions.Action instances.

An instance of this class can be referenced using the service name map-actions.ActionService. The service can be used in different workflows to trigger the same functionality.

The action service will emit events action-added and action-removed when a new action is registered or an existing action is unregistered. In both cases, an object {id: "action-id"} is passed to the event handler.

Hierarchy

  • EventSource<ActionServiceEvents>
    • ActionService

Methods

  • Get currently available action ids.

    Returns string[]

  • Checks if an action with the given ID exists.

    Parameters

    • actionId: string

      ID of the action.

    Returns boolean

  • Register event listener for specific events.

    Type Parameters

    • Name extends EventNames<ActionServiceEvents>

    Parameters

    • eventName: Name

      name of the event

    • callback: EventCallback<ActionServiceEvents[Name]>

      the event handler callback will be invoked when the event has been emitted

    Returns EventHandle

    a handle to unregister from the event

  • Register event listener for any event.

    Parameters

    • eventName: "*"

      must be "*" for this overload

    • callback: EventCallback<{
          id: string;
      } | {
          id: string;
      }>

      the event handler callback will be invoked when any event has been emitted

    Returns EventHandle

    a handle to unregister from the events

  • Register event listener for the events listed in eventName. Comma separated event names are possible, for example "eventA,eventB".

    Parameters

    • eventName: string | string[]

      the event name or list of names

    • callback: EventCallback<unknown>

      the event handler callback

    Returns EventHandle

    a handle to unregister from the event(s)

  • Trigger the actions and return their response as a list of Promises.

    Parameters

    • actionIds: readonly string[]

      List of action IDs to trigger. To trigger all available actions pass a list with only one entry: ["*"].

    • Optional options: ActionOptions

      Options to be passed to the actions. This can, for example, include the items of a search result.

    Returns Promise<unknown>[]

    List of Promises with the actions' result of their trigger methods.

Generated using TypeDoc