Table of contents

The reactor is a user-friendly interface for starting and stopping an .

Calling .start() will attach the scheduler and execute the effect immediately the first time it is called.

If the reactor is stopped, calling .start() will re-attach the scheduler but will only execute the effect if any of its parents have changed since it was stopped.

You can create a reactor with reactor.

interface Reactor<T = unknown> {}

Properties

scheduler

The underlying effect scheduler.

scheduler: EffectScheduler<T>

Methods

start

Start the scheduler. The first time this is called the effect will be scheduled immediately.

If the reactor is stopped, calling this will start the scheduler again but will only execute the effect if any of its parents have changed since it was stopped.

If you need to force re-execution of the effect, pass { force: true }.

Parameters

NameDescription

options

{
  force?: boolean
}

Returns

void

stop

Stop the scheduler.


Prev
EffectSchedulerOptions
Next
Signal

We use cookies on this website.
Learn more in our Cookie Policy.