@embra/reactivity - v0.0.3
    Preparing search index...

    Interface Readable<TValue>

    A Readable is a reactive value that can be read and subscribed to.

    interface Readable<TValue = any> {
        $version: number;
        get: () => TValue;
        name?: string;
        value: TValue;
        reaction(subscriber: Subscriber<TValue>): Disposer;
        subscribe(subscriber: Subscriber<TValue>): Disposer;
        unsubscribe(subscriber?: (...args: any[]) => any): void;
    }

    Type Parameters

    • TValue = any

    Hierarchy (View Summary)

    Index

    Properties

    $version: number

    A version representation of the value. If two versions of a $ is not equal(Object.is), it means the value has changed (event if the value is equal).

    get: () => TValue

    Get current value.

    name?: string
    value: TValue

    Current value of the $.

    Methods

    • Remove the given subscriber or all subscribers if no subscriber is provided.

      Parameters

      • Optionalsubscriber: (...args: any[]) => any

        Optional subscriber function to remove. If not provided, all subscribers will be removed.

      Returns void