Interface TaggedHook<T>

TaggedHook defines a proxy hook which register handlers that are triggered only if the TaggedHook.tags are empty or includes at least one of the event data tag(s).

Type Parameters

  • T

Hierarchy

Methods

  • Add registers a new handler to the hook by appending it to the existing queue.

    The fn handler will be called only if the event data tags satisfy h.CanTriggerOn.

    Parameters

    Returns string

  • CanTriggerOn checks if the current TaggedHook can be triggered with the provided event data tags.

    Parameters

    • tags: string[]

    Returns boolean

  • PreAdd registers a new handler to the hook by prepending it to the existing queue.

    The fn handler will be called only if the event data tags satisfy h.CanTriggerOn.

    Parameters

    Returns string

  • Remove removes a single hook handler by its id.

    Parameters

    • id: string

    Returns void

  • RemoveAll removes all registered handlers.

    Returns void

  • Trigger executes all registered hook handlers one by one with the specified data as an argument.

    Optionally, this method allows also to register additional one off handlers that will be temporary appended to the handlers queue.

    The execution stops when:

    • hook.StopPropagation is returned in one of the handlers
    • any non-nil error is returned in one of the handlers

    Parameters

    Returns void

Generated using TypeDoc