import { Subject, Observable } from 'rxjs'; import { SupportedSubjectTypes, SubjectType, OptionValue, SupportedKeyTypes } from '../interfaces'; /** * BaseMap class used to provide shared functionality for implementing classes. */ export declare abstract class BaseMap { private __subjectClass; private __initialOption; /** * Native JavaScript map that holds the key-values */ protected _map: Map>; /** * Size of the map */ size: number; /** * Must be overridden. Takes a {@link SupportedSubjectTypes} and any initial option * - {@link BehaviorMap} initial option is the starting value for the `BehaviorSubject` * - {@link ReplayMap} replay amount for the `ReplaySubject` * - {@link ObservableMap} ignores this value * * @param subjectClass subject type to use * @param initialOption intial option to pass the subject on construction * @returns this instance * */ protected constructor(subjectClass: S, initialOption?: OptionValue); /** * Check if a key exists on the map * * @param key to check for * @returns check if the key exists */ has(key: K): boolean; /** * Set a key-value pair. This will create a {@link SupportedSubjectTypes} * (or reuse if key already existed) for the key specified. * It will call `.next(value)` on that subject. * @param key key to index value * @param value value to store */ set(key: K, value: V): this; /** * Emit an error on the key's observable. This * will call `.error(error)` which ends the observable * stream. * * It then removes the key-value from the map since the * observable has ended. * * @param key key to emit error on * @param error error to emit */ emitError(key: K, error: any): this; /** * Will call `.complete()` on all subjects and * clear the map */ clear(): void; /** * Will call `.complete()` on key's subject and * remove the key from the map. * * @param key key to remove */ delete(key: K): boolean; /** * Get the map's keys */ keys(): IterableIterator; /** * Get the observable for the specified key. * * @param key key to retrieve */ get$(key: K): Observable; /** * Will call the function for each observable-key value in the map. * * @param callbackfn function to execute on the maps key-value */ forEach$(callbackfn: (value: Observable, key: K) => void): void; /** * Get the map's entries as key-observable */ entries$(): IterableIterator<[K, Observable]>; /** * Get the map's ovservable values */ values$(): IterableIterator>; /** * Get (or create) subject for a specified key * * @param key key's subject to return * */ protected _getOrInit$(key: K): SubjectType; /** * Method to create a subject based on the instance's * __subjectClass and __initialOption (passed in on construction) */ private __createSubject; }