UNPKG

@creditkarma/consul-client

Version:

A client for Hashicorp Consul written in TypeScript

21 lines (20 loc) 724 B
export declare type ValueCallback<T> = (value: T) => void; export declare type ErrorCallback = (err: Error) => void; export declare type ValueSink<T> = (err: Error | undefined, value?: T) => boolean; export declare type UpdateFunction<T> = (sink: ValueSink<T>) => void; export declare class Observer<T> { static create<T>(value: T): Observer<T>; private _isActive; private _value; private _previous; private _listeners; private _errorListeners; constructor(updater: UpdateFunction<T>, value?: T); destroy(): void; previous(): T | null; current(): T | null; onValue(cb: ValueCallback<T>): this; onError(cb: ErrorCallback): this; private update; private updateErrors; }