@tempots/dom
makeEffect() function
Executes the provided function fn
whenever any of the signals in the signals
array change. Returns a disposable object that can be used to stop the effect.
Signature:
makeEffect: (fn: () => void, signals: Array<AnySignal>) => () => void
Parameters
Parameter |
Type |
Description |
---|---|---|
fn |
() => void |
The function to execute when the signals change. |
signals |
Array<AnySignal> |
An array of signals to watch for changes. |
Returns: () => void
A disposable object that can be used to stop the effect.