Skip to content

hookSetup

hookSetup<K>(key: K): <T>(…config: Parameters<Adapters<Parameters<MethodOf<T, K>>[0]>[K]>) => (target: T) => DisposeFunc

Defined in: state-machine-hooks.ts:17

Creates a lifecycle hook enhancer for a given StateMachine method key. Returns a function that applies the hook and provides a disposer to remove it.

Usage:

hookSetup("before")(config)(machine)
Type Parameter
K extends string
ParameterType
keyK

<T>(…config: Parameters<Adapters<Parameters<MethodOf<T, K>>[0]>[K]>): (target: T) => DisposeFunc

Type Parameter
T extends HasMethod<K>
ParameterType
configParameters<Adapters<Parameters<MethodOf<T, K>>[0]>[K]>

(target: T): DisposeFunc

ParameterType
targetT

DisposeFunc