Back to Pocketbase

Interface TaggedHook<T>

static/jsvm/interfaces/hook.TaggedHook.html

latest2.9 KB
Original Source

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

Index

Methods

bindbindFunccanTriggerOnlengthtriggerunbindunbindAll

Methods

bind

  • bind(handler): string

Bind registers the provided handler to the current hooks queue.

It is similar to [Hook.Bind] with the difference that the handler function is invoked only if the event data tags satisfy h.CanTriggerOn.

Parameters

handler: hook.Handler<T>

Returns string

bindFunc

  • bindFunc(fn): string

BindFunc registers a new handler with the specified function.

It is similar to [Hook.Bind] with the difference that the handler function is invoked only if the event data tags satisfy h.CanTriggerOn.

Parameters

fn: ((e) => void)
- 
  - (e): void
  - 

Parameters

    - 
e: T

Returns void

Returns string

canTriggerOn

  • canTriggerOn(tagsToCheck): boolean

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

It returns always true if the hook doesn't have any tags.

Parameters

tagsToCheck: string[]

Returns boolean

length

  • length(): number

Length returns to total number of registered hook handlers.

Returns number

trigger

  • trigger(event, ...oneOffHandlerFuncs): void

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

  • unbind(...idsToRemove): void

Unbind removes one or many hook handler by their id.

Parameters

Rest ...idsToRemove: string[]

Returns void

unbindAll

  • unbindAll(): void

UnbindAll removes all registered handlers.

Returns void

Settings

Member Visibility

  • Inherited

Theme

OSLightDark

On This Page

Generated using TypeDoc