Appearance

`FormulaFn`

optimization

`T`

The 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`

`() => T`

A function that computes a value from other reactive values.

`description?`

`string`

A description of the formula.

`optional`

`returns`

`FormulaFn`

A formula that returns the result of the given function.

### Properties

`current`

`readonly current: T;`

The current value of the formula.

`PolledFormulaFn`

renderer

`T`

The 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`

`() => T`

A function that computes a value from other reactive values.

`description?`

`string`

A description of the formula.

`optional`

`returns`

`PolledFormulaFn`

A 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.