export interface ReactiveStateOptions { equals?: (a: T, b: T) => boolean; } /** * Represents a single piece of reactive state that can be tracked by a ReactiveContext. * It's analogous to Signal.State. */ export declare class ReactiveState { private currentValue; private readonly equals; constructor(initialValue: T, options?: ReactiveStateOptions); /** * Retrieves the current value of the state. * If called within a ReactiveContext task, it enables tracking. * @returns The current value. */ get(): T; /** * Updates the value of the state. * If the new value is different from the old one, it notifies any active * ReactiveContext that it has become dirty. * @param newValue The new value. */ set(newValue: T): boolean; } /** * Manages the execution of an asynchronous, reactive task. * It now works by tracking changes on ReactiveState instances used within its task. */ export declare class ReactiveContext { readonly watch: boolean; private isRunning; private hasChanged?; private caches; private readonly task; constructor(task: () => Promise, watch?: boolean); /** @internal */ getOrPushCache(state: ReactiveState, value: T): T; /** @internal */ notifyChange(): void; /** * TODO 实现off * @param watch * @returns */ run({ signal }?: ReactiveContextRunOptions): Promise; } export interface ReactiveContextRunOptions { signal?: AbortSignal; } //# sourceMappingURL=reactive-context.d.ts.map