Skip to content

effect

const effect: <T>(…config: [EffectFunc<Parameters<MethodOf<T, "effect">>[0]>]) => (target: T) => DisposeFunc

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

Type Parameter
T extends HasMethod<"effect">
ParameterType
config[EffectFunc<Parameters<MethodOf<T, "effect">>[0]>]

(target: T): DisposeFunc

ParameterType
targetT

DisposeFunc

effect Enhances the effect lifecycle method of a StateMachine. Returns a disposer to undo the enhancement. See StateMachine.effect.

Usage:

setup(machine)(effect(fn))