Skip to content
forma.
v3.0
☰
Browse documentation
Start here
Build interfaces
Native rendering
Tooling
Security and operations
Architecture
Application guides
API reference

Docs/API reference

FORMA 3.0

@getforma/core/tc39

The optional class-based State and Computed compatibility API.

View source ↗Markdown ↓Source 2006423
On this page

Generated from the published 3.0.0 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.0.0 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 · JSX namespace

Find your next answer.

Search Forma 3.0 documentation, guides and examples.