Skip to content
forma.
v3.2.0-rc.2
☰
Browse documentation
Start here
Application guides
API reference

Docs/API reference

FORMA 3.2

@getforma/core/tc39

The optional class-based State and Computed compatibility API.

View source ↗Markdown ↓Source 3b6c776
On this page

These guides target the 3.2.0-rc.2 release candidate. It is a prerelease; check the release record and qualify your application before rollout. Generated from the installed, version-pinned 3.2.0-rc.2 TypeScript declarations. Signatures, overloads and JSDoc are taken from the package; private class members are omitted. Declaration links point to version-pinned package files.

These are Forma's optional compatibility classes, not native browser APIs or a claim that a TC39 proposal has shipped. Import this subpath explicitly.

Read the usage guide or all entry points.

2 exports · published 3.2.0-rc.2 declarations

ts
import { Computed } from '@getforma/core/tc39';

Values and functions

Computed#

Class export · Declaration, line 44

ts
declare class Computed<T> {
    constructor(fn: () => T);
    get(): T;
}

TC39-compatible computed value. Equivalent to Signal.Computed in the TC39 proposal.

ts
const count = new State(0);
const doubled = new Computed(() => count.get() * 2);
console.log(doubled.get()); // 0
count.set(5);
console.log(doubled.get()); // 10

State#

Class export · Declaration, line 25

ts
declare class State<T> {
    constructor(initialValue: T, options?: SignalOptions<T>);
    get(): T;
    set(value: T): void;
}

TC39-compatible reactive state container. Equivalent to Signal.State in the TC39 proposal.

ts
const count = new State(0);
console.log(count.get()); // 0
count.set(1);

Related declarations: SignalOptions

Other entry points

@getforma/core · @getforma/core/runtime · @getforma/core/runtime-hardened · @getforma/core/runtime-csp · @getforma/core/http · @getforma/core/storage · @getforma/core/compiled · @getforma/core/navigation · JSX namespace

Find your next answer.

Search versioned Forma documentation, guides and examples.