Vixen
02b45cc4
csharp
public sealed class Signal<T>

A writable value that everything reading it is re-evaluated against.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Writing a value equal to the current one does nothing at all — no version bump, no notification, no effect run. That is not an optimisation bolted on the side; it is the property the rest of the graph is built to preserve, and the reason a text box that re-assigns the same string on every keystroke does not repaint the window.

"Equal" means Default unless a comparer is supplied. For a mutable reference type that is usually wrong — the object is the same instance, so it compares equal, and a change made in place is invisible. Either hold an immutable value, or pass Never``1 and accept that every write propagates.

Fields and properties (1)

  • public T Value

    The current value.

Methods (5)

  • public Signal(T initial, IEqualityComparer<T>? comparer = null)

    Creates a signal holding .

  • public T Peek()

    The current value without recording a dependency.

  • public void Update(Func<T, T> update)

    Replaces the value with a function of the current one.

  • public void Update<TState>(TState state, Func<T, TState, T> update)

    Replaces the value with a function of the current one and some state.

  • public void Invalidate()

    Forces every dependent to re-evaluate, whatever the comparer thinks.

Used by (32)

  • AsyncComputedVixen.Ui.Reactive
  • AsyncComputedTestsVixen.Ui.Reactive.Tests
  • BareVixen.Ui.Tests
  • BoundVixen.Ui.Tests
  • BranchingVixen.Ui.Tests
  • CarryingVixen.Ui.HotReload.Tests
  • CompositionTestsVixen.Ui.Tests
  • ComputedTestsVixen.Ui.Reactive.Tests
  • CounterVixen.Ui.Tests
  • CountingVixen.Ui.HotReload.Tests
  • EffectPassTestsVixen.Ui.Tests
  • EffectTestsVixen.Ui.Reactive.Tests
  • EmitterTestsVixen.Ui.Markup.Tests
  • GraphTestsVixen.Ui.Reactive.Tests
  • GuestVixen.Ui.Tests
  • HostingVixen.Ui.Tests
  • HotReloadTestsVixen.Ui.HotReload.Tests
  • LeadingBranchVixen.Ui.Tests
  • LinkedSignalTestsVixen.Ui.Reactive.Tests
  • ListingVixen.Ui.Tests
  • MixedVixen.Ui.Tests
  • NestedVixen.Ui.Tests
  • SignalTestsVixen.Ui.Reactive.Tests
  • SwitchingVixen.Ui.Tests
  • VxmlGeneratorTestsVixen.Ui.Markup.Generators.Tests
  • BackgroundTaskVixen.Editor.Ui
  • CommandStackVixen.Editor.Core
  • EditorDocumentVixen.Editor.Core
  • EditorProjectVixen.Editor.Core
  • EditorPropertyVixen.Editor.Core
  • TaskCenterVixen.Editor.Ui
  • UndoHistoryVixen.Editor.App