UNPKG

rx-synchronizer

Version:

Commonly-used synchronizer bases that can be composed into more specific purposes.

31 lines (30 loc) 1.08 kB
import { Never, Omit, Try } from 'javascriptutilities'; import { NextObserver, Observable } from 'rxjs'; import * as TriggerSync from './trigger'; export declare type Depn<T> = Omit<TriggerSync.Depn<number>, 'triggerReceiver' | 'triggerStream'> & Readonly<{ /** * If this is true, invalid results will not be filtered out. */ allowInvalidResult: boolean; /** * Consider an object a match if any of the key defined in this Array has a * match. */ objectPropKeys: keyof T | (keyof T)[]; allObjectStream: Observable<Try<Partial<T>[]>>; objectPropStream: Observable<Try<any>>; objectIndexReceiver: NextObserver<Never<number>>; }>; export declare type Type = Readonly<{ synchronize: <T>(dependency: Depn<T>) => void; }>; /** * Find the index of some object among an array of objects (based on a specified * property) and emit that. */ export declare class Impl implements Type { private readonly triggerSync; constructor(); constructor(triggerSync: TriggerSync.Type); synchronize<T>(dependency: Depn<T>): void; }