import { IObservable, IObservableWithChange, IObserver, IReader, ITransaction } from "../base.js"; import { DebugOwner } from "../debugName.js"; import { DisposableStore, Event, IDisposable } from "../commonFacade/deps.js"; import { DebugLocation } from "../debugLocation.js"; export declare function observableFromPromise(promise: Promise): IObservable<{ value?: T; }>; export declare function signalFromObservable(owner: DebugOwner | undefined, observable: IObservable): IObservable; /** * Creates an observable that debounces the input observable. */ export declare function debouncedObservable(observable: IObservable, debounceMs: number | ((lastValue: T | undefined, newValue: T) => number), debugLocation?: DebugLocation): IObservable; /** * Creates an observable that debounces the input observable. */ export declare function debouncedObservable2(observable: IObservable, debounceMs: number | ((currentValue: T | undefined, newValue: T) => number), debugLocation?: DebugLocation): IObservable; export declare function wasEventTriggeredRecently(event: Event, timeoutMs: number, disposableStore: DisposableStore): IObservable; /** * This makes sure the observable is being observed and keeps its cache alive. */ export declare function keepObserved(observable: IObservable): IDisposable; /** * This converts the given observable into an autorun. */ export declare function recomputeInitiallyAndOnChange(observable: IObservable, handleValue?: (value: T) => void): IDisposable; export declare class KeepAliveObserver implements IObserver { private readonly _forceRecompute; private readonly _handleValue; private _counter; constructor(_forceRecompute: boolean, _handleValue: ((value: any) => void) | undefined); beginUpdate(observable: IObservable): void; endUpdate(observable: IObservable): void; handlePossibleChange(observable: IObservable): void; handleChange(observable: IObservableWithChange, change: TChange): void; } export declare function derivedObservableWithCache(owner: DebugOwner, computeFn: (reader: IReader, lastValue: T | undefined) => T): IObservable; export declare function derivedObservableWithWritableCache(owner: object, computeFn: (reader: IReader, lastValue: T | undefined) => T): IObservable & { clearCache(transaction: ITransaction): void; setCache(newValue: T | undefined, tx: ITransaction | undefined): void; }; /** * When the items array changes, referential equal items are not mapped again. */ export declare function mapObservableArrayCached(owner: DebugOwner, items: IObservable, map: (input: TIn, store: DisposableStore) => TOut, keySelector?: (input: TIn) => TKey): IObservable; export declare function isObservable(obj: unknown): obj is IObservable;