FormulaFnoptimization
TThe value computed by the formula.
Constructor Function
function FormulaFn(fn, description?): FormulaFn;A FormulaFn is a function that automatically caches the result of its computation until any of its reactive dependencies change.
fn() => TA function that computes a value from other reactive values.
description?stringA description of the formula.
optionalreturnsFormulaFnA formula that returns the result of the given function.
Properties
current
readonly current: T;The current value of the formula.
PolledFormulaFnrenderer
TThe value computed by the formula.
Constructor Function
function PolledFormulaFn(fn, description?): PolledFormulaFn;A PolledFormulaFn has an identical API signature to FormulaFn. However, when a PolledFormulaFn’s value is requested, it always recomputes the value. This is designed for situations where you are mixing Starbeam reactivity with other forms of reactivity.
fn() => TA function that computes a value from other reactive values.
description?stringA description of the formula.
optionalreturnsPolledFormulaFnA polled formula that returns the result of the given function.
Details: Using PolledFormulaFn in Renderers
PolledFormulaFn in RenderersThis allows a renderer to listen for changes to the formula’s reactive dependencies, but still choose to recompute the formula’s value when it has its own reason to believe that the formula is out of date. Most renderers use PolledFormulaFn as the primary mechanism for gluing Starbeam reactivity with their framework’s rendering.
Properties
current
readonly current: T;The current value of the formula.