rvx
Version:
A signal based rendering library
42 lines (41 loc) • 1.3 kB
TypeScript
import { Signal } from "../core/signals.js";
/**
* A signal for tracking accesses to values that may not exist.
*/
export declare class ProbeSignal<T> extends Signal<T> {
#private;
/**
* Create a new probe signal.
*
* @param onDisposable A function to call when it is guaranteed that this signal is no longer watched.
* @param value The initial value.
*/
constructor(onDisposable: () => void, value: T);
notify(): void;
}
/**
* A map for tracking keyed accesses to values that may not exist.
*/
export declare class ProbeMap<K, V> {
#private;
/**
* Create a new probe map.
*
* @param get A function to get the current value for a key at any time.
*/
constructor(get: (key: K) => V);
/**
* Access the specified key.
*
* If an expression is currently evaluated to track signal accesses, this will create and access a probe signal for the specified key. That probe signal is automatically removed when it is guaranteed that this key is no longer watched.
*/
access(key: K): void;
/**
* Update a key-value pair and notify potential observers.
*/
update(key: K, value: V): void;
/**
* Set the value of all existing probe signals in this map.
*/
fill(value: V): void;
}