Back to Pocketbase

Interface mainHook<T>

static/jsvm/interfaces/hook.mainHook.html

latest2.6 KB
Original Source

Interface mainHook<T>

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

Type Parameters

T

Hierarchy

Index

Methods

bindbindFunclengthtriggerunbindunbindAll

Methods

bind

  • bind(handler): string

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

handler: hook.Handler<T>

Returns string

bindFunc

  • bindFunc(fn): 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

  • 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