Module memory

Source
Expand description

Memory utilities

Functions§

Source§

bidgen(): () => bigint

Return an id generator that returns bigint, starting from 1n, and will always return a new bigint

Source§

cell<T>(args: CellConstructor<T>): Cell<T>

Create a Cell

Source§

idgen(): () => number

Returns an id generator that returns number staring from 1 and always increasing. The number could become inaccurate (not integer) when exceeding Number.MAX_SAFE_INTEGER (which is 2^53 - 1

Source§

makeEmpType<T, TRepr>(
    args: EmpConstructor<T, TRepr>,
): (ptr: TRepr) => Emp<T, TRepr>

Create a factory function for an Emp type. See Emp

Source§

persist<T>(args: PersistConstructor<T>): Persist<T>

Create a cell that persists its value to a web storage

Source§

safeidgen(n: number): () => number

Return an id generator that will generate ids in order from 1 to n, wrapping around to 1 when it's n

Interfaces§

Cell

A light weight storage wrapper around a value that can be subscribed to for changes

CellConstructor

Args for constructing a cell

Emp

A non-null, Engine-managed Pointer

EmpConstructor

Args for constructing a Emp type

Persist

A cell that also persists its value

PersistConstructor

Args for creating a persisted cell

PersistStorage

Interface for Web Storage API used by persist.