public sealed class EffectWork that re-runs when anything it read changes.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The only place in the graph where something actually happens. A signal holds a value and a computed derives one; an effect is what assigns to an element's property, and in the generated UI code there is one per dynamic expression in the markup — which is the whole of ADR-010's "no VDOM": setting a signal invalidates exactly the effects that read it, and each assigns exactly the property it was written for. No tree walk, no diff.
An effect never runs on the write. It queues, and Flush runs it at the point in the frame the UI system chose. That includes the first run: a new effect is queued, not executed, so constructing a subtree does not run half of it before the rest exists.
Fields and properties (2)
public bool IsSuspendedWhether this effect has been suspended after misbehaving.
public bool IsDisposedWhether Dispose has been called.
Methods (4)
public Effect(Action action, EffectScheduler? scheduler = null, string? origin = null, int line = 0)Creates an effect and queues its first run.
public void Dispose()Unhooks the effect from everything it reads. It will not run again.
public void Invalidate()Runs the effect again at the next flush, whether or not anything changed.
public void Resume()Lets a suspended effect run again.
Used by (9)
- AsyncComputedVixen.Ui.Reactive
- AsyncComputedTestsVixen.Ui.Reactive.Tests
- BuildContextVixen.Ui
- CollectionSignalTestsVixen.Ui.Reactive.Tests
- EffectSchedulerVixen.Ui.Reactive
- EffectTestsVixen.Ui.Reactive.Tests
- GraphTestsVixen.Ui.Reactive.Tests
- LinkedSignalTestsVixen.Ui.Reactive.Tests
- SignalTestsVixen.Ui.Reactive.Tests