UNPKG

stream-chat

Version:

JS SDK for the Stream Chat API

17 lines 864 B
export declare type Patch<T> = (value: T) => T; export declare type ValueOrPatch<T> = T | Patch<T>; export declare type Handler<T> = (nextValue: T, previousValue: T | undefined) => void; export declare type Unsubscribe = () => void; export declare const isPatch: <T>(value: ValueOrPatch<T>) => value is Patch<T>; export declare class StateStore<T extends Record<string, unknown>> { private value; private handlerSet; private static logCount; constructor(value: T); next: (newValueOrPatch: ValueOrPatch<T>) => void; partialNext: (partial: Partial<T>) => void; getLatestValue: () => T; subscribe: (handler: Handler<T>) => Unsubscribe; subscribeWithSelector: <O extends readonly unknown[] | Readonly<Record<string, unknown>>>(selector: (nextValue: T) => O, handler: Handler<O>) => Unsubscribe; } //# sourceMappingURL=store.d.ts.map