Skip to content

Cell

T

The type of value contained in the cell.

Constructor Function

function Cell(value, options?): Cell;

The Cell API is the fundamental storage building block of Starbeam.

valueT

The initial value of the cell.

options.description?string

A description of the cell.

optional

options.equals?(a: T, b: T) => boolean

A function that returns true if the values are equal.

optional

returnsCell

A cell with the given initial value.

Properties

current

current: T;

The current value of the cell.

bolt Methods

update

update(updater): boolean;
updater(prev: T) => T

A function that takes the previous value of the cell and returns the new value.

returnsboolean

true if the value changed, false otherwise.

set

set(value): boolean;
valueT

The new value of the cell.

returnsboolean

true if the value changed, false otherwise.

freezeoptimization

freeze(): void;

The freeze method prevents the cell from updating. This allows for Starbeam’s internals to avoid checking if the cell has changed when it’s used in a formula.

Released under the MIT license