@kayahr/signal
    Preparing search index...

    Function createEffect

    • Creates an eager reactive effect.

      The effect runs immediately once and then reruns synchronously whenever one of the dependencies read during its last execution changed.

      The return value of each execution is passed into the next execution as context.previous. When options.initial is set, the first execution receives that value instead of undefined.

      context.onCleanup registers callbacks that run before the next execution and when the effect is disposed.

      Effects return an explicit handle for manual disposal and additionally register their cleanup on the active scope, if there is one.

      Type Parameters

      • Next

      Parameters

      Returns Effect

      An effect handle for manual disposal.

    • Creates an eager reactive effect.

      The effect runs immediately once and then reruns synchronously whenever one of the dependencies read during its last execution changed.

      The return value of each execution is passed into the next execution as context.previous. When options.initial is set, the first execution receives that value instead of undefined.

      context.onCleanup registers callbacks that run before the next execution and when the effect is disposed.

      Effects return an explicit handle for manual disposal and additionally register their cleanup on the active scope, if there is one.

      Type Parameters

      • Init
      • Next

      Parameters

      Returns Effect

      An effect handle for manual disposal.