class · System.Reactive

Effect

public class System.Reactive.Effect : System.Any

A computation that runs again whenever a Source it read notifies, until disposed.

Kind
class
Namespace
System.Reactive
Assembly
System.Core
Access
public, final
Source file
Reactive.ant

Inheritance

Base classes
Any Effect

Constructors

constructor Effect(body: func<> : void)
#

Properties

property Sources: i32
#

read-only

How many sources its last run read.

property Disposed: bool
#

read-only

Methods

method Run() -> void
#

Runs the computation, tracking what it reads (not while it already runs, nor once disposed). It starts from no dependencies: only what this run reads keeps running it.

method Trigger() -> void
#

What a change does to it: runs it, or (lazy) marks it stale once and notifies what depends on it.

method Dispose() -> void
#

Stops it: it never runs again, and no Source keeps it.

Private and internal members (16)

field body: func<> : void
#

private

field running: bool
#

private

field disposed: bool
#

private

private

field slots: System.List<i32>
#

private

For each source, its slot in that source's observers.

field ids: System.HashSet<i64>?
#

private

The ids of sources once there are more than a few (below that a search of the list is quicker).

field Pending: bool
#

internal

field PendingAt: i32
#

internal

Where it is in the batch's pending effects (while Pending).

field Runs: i64
#

internal

How many times it let go of its sources: a Source's mark of one of its runs holds until then.

field Lazy: bool
#

internal

A lazy effect (a Computed's) does not run when notified: it goes stale, and tells Dependents.

field Stale: bool
#

internal

field Dependents: System.Reactive.Source?
#

internal

method Reads(source: System.Reactive.Source) -> bool
#

internal

Whether this run read source already.

method Watching(source: System.Reactive.Source, slot: i32) -> i32
#

internal

source keeps it in slot: where the source is in its list.

method Moved(back: i32, slot: i32) -> void
#

internal

The source at back moved it to slot.

method Release() -> void
#

private

Inherited members (5)

Source

Effect as Larva HIR, decompiled from its Larva HIR.

System.Reactive.Effect.hir
// A computation that runs again whenever a Source it read notifies, until disposed.
public class System.Reactive.Effect : System.Any
{
    field body: func<> : void
    field running: bool
    field disposed: bool
    field sources: System.List<System.Reactive.Source>
    // For each source, its slot in that source's observers.
    field slots: System.List<i32>
    // The ids of `sources` once there are more than a few (below that a search of the list is quicker).
    field ids: System.HashSet<i64>?
    field Pending: bool
    // Where it is in the batch's pending effects (while Pending).
    field PendingAt: i32
    // How many times it let go of its sources: a Source's mark of one of its runs holds until then.
    field Runs: i64
    // A lazy effect (a Computed's) does not run when notified: it goes stale, and tells `Dependents`.
    field Lazy: bool
    field Stale: bool
    field Dependents: System.Reactive.Source?
    // Whether this run read `source` already.
    method Reads(source: System.Reactive.Source) -> bool
    // `source` keeps it in `slot`: where the source is in its list.
    method Watching(source: System.Reactive.Source, slot: i32) -> i32
    // The source at `back` moved it to `slot`.
    method Moved(back: i32, slot: i32) -> void
    method Release() -> void
    constructor Effect(body: func<> : void)
    // Runs the computation, tracking what it reads (not while it already runs, nor once disposed). It starts
    // from no dependencies: only what this run reads keeps running it.
    method Run() -> void
    // What a change does to it: runs it, or (lazy) marks it stale once and notifies what depends on it.
    method Trigger() -> void
    // Stops it: it never runs again, and no Source keeps it.
    method Dispose() -> void
    // How many sources its last run read.
    property Sources: i32
    property Disposed: bool
}
Esc