@obsidize/rx-map
Version:
ES6 Map with rxjs extensions for change detection
26 lines (25 loc) • 1.56 kB
TypeScript
import { BehaviorSubject, Observable } from 'rxjs';
import { OneToManyRelationship } from './relationships/one-to-many-relationship';
import { RxEntityMap } from './maps/rx-entity-map';
import { PropertySelector } from './common/utility';
import { Subsink } from './common/subsink';
/**
* Base class for defining an app's storage data.
* Use the define***() methods to stand up your core storage infrastructure.
*/
export declare class RxStore {
protected readonly effectSubscriptions: Subsink;
protected readonly properties: Set<BehaviorSubject<any>>;
protected readonly entityMaps: Set<RxEntityMap<any, any>>;
protected readonly oneToManyRelationships: Set<OneToManyRelationship<any, any, any>>;
protected onDestroyProperty(property: BehaviorSubject<any>): void;
protected onDestroyEntityMap(entityMap: RxEntityMap<any, any>): void;
protected onDestroyOneToManyRelationship(relation: OneToManyRelationship<any, any, any>): void;
protected defineProperty<V>(startValue: V): BehaviorSubject<V>;
protected registerProperty<V>(property: BehaviorSubject<V>): BehaviorSubject<V>;
protected defineEntity<K, V>(selectKey: PropertySelector<K, V>): RxEntityMap<K, V>;
protected registerEntity<K, V>(entityMap: RxEntityMap<K, V>): RxEntityMap<K, V>;
protected registerEffect<T>(effect: Observable<T>): Observable<T>;
protected defineEntityForeignKey<K, V, T>(entityMap: RxEntityMap<K, V>, selectForeignKey: PropertySelector<T, V>): OneToManyRelationship<K, V, T>;
destroy(): void;
}