//#region src/observable.d.ts declare namespace Observer { /** * Update callback function. * * @param key - * - `string` - property which has updated. * - `false` - a normal update has completed. * - `true` - initial event; instance is ready. * - `null` - terminal event; instance is expired. */ type Notify = (key: Signal) => (() => void) | null | void; type EffectCleanup = (update: boolean | null) => void; type Effect = (this: T, proxy: T, changed: readonly Event[]) => EffectCleanup | Promise | null | void; type Event = number | string | symbol; type Signal = Event | true | false | null; type Callback = () => void | null; } interface Observer { /** Becomes `true` once the subject has emitted its initial event. */ ready?: true; listeners: Map | undefined>; /** Recursion guard for an in-progress emit pass. */ pending: Set; /** Accumulator drained by the next microtask. */ events: Set; } declare const Observer: unique symbol; /** * Fetch the dispatch bundle attached to an object. * - returns the bundle if active * - returns `null` if the subject has been terminated * - returns `undefined` if the subject was never observable * * With `create: true`, attaches a fresh bundle iff the slot is undefined. * A terminated (null) slot is not resurrected. */ declare function observer(state: object, create: true): Observer; declare function observer(state: object, create?: boolean): Observer | undefined | null; declare function touch(from: object, key: any): void; declare function touch(from: object, key: any, value?: T): T; declare function listener(subject: T, callback: Observer.Notify, select?: Observer.Signal | Set): () => boolean; declare function queued(state: object): K[] & PromiseLike; declare function event(state: object, key?: Observer.Event | null, silent?: boolean): void; /** * Create a side-effect which will update whenever values accessed change. * Callback is called immediately and whenever values are stale. * * @param target - Instance of State to observe. * @param callback - Function to invoke when values change. * @param requireValues - If `true` will throw if accessing a value which is `undefined`. */ declare function watch(target: T, callback: Observer.Effect>, requireValues: true, transition?: (work: () => void) => void): () => void; declare function watch(target: T, callback: Observer.Effect, recursive?: boolean, transition?: (work: () => void) => void): () => void; declare function capture(scope: (release: (update?: boolean | null) => void) => void): void; //#endregion export { Observer, capture, event, listener, observer, queued, touch, watch }; //# sourceMappingURL=observable.d.ts.map