Interface Cell<T>

Source
Expand description

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

Created via cell()

import { cell } from "@pistonite/pure/memory";

const myCell = cell(true);
interface Cell<T> {
    get(): T;
    set(value: T): void;
    subscribe(
        callback: (value: T) => void,
        notifyImmediately?: boolean,
    ): () => void;
}

Methods§

Source§

get(): T

Source§

set(value: T): void

Source§

subscribe(callback: (value: T) => void, notifyImmediately?: boolean): () => void