Interface mainHook<T>

wrapped local Hook embedded struct to limit the public API surface.

Type Parameters

  • T

Hierarchy

Methods

  • Bind registers the provided handler to the current hooks queue.

    If handler.Id is empty it is updated with autogenerated value.

    If a handler from the current hook list has Id matching handler.Id then the old handler is replaced with the new one.

    Parameters

    Returns string

  • BindFunc is similar to Bind but registers a new handler from just the provided function.

    The registered handler is added with a default 0 priority and the id will be autogenerated.

    If you want to register a handler with custom priority or id use the [Hook.Bind] method.

    Parameters

    • fn: ((e) => void)
        • (e): void
        • Parameters

          • e: T

          Returns void

    Returns string

  • Length returns to total number of registered hook handlers.

    Returns number

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

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

    NB! Each hook handler must call event.Next() in order the hook chain to proceed.

    Parameters

    • event: T
    • Rest ...oneOffHandlerFuncs: ((_arg0) => void)[]

    Returns void

  • Unbind removes one or many hook handler by their id.

    Parameters

    • Rest ...idsToRemove: string[]

    Returns void

  • UnbindAll removes all registered handlers.

    Returns void

Generated using TypeDoc