RXJS enhanced Array, Map, WeakMap, Set and WeakSet.
npm install rxjs-collection
Each collection has been enhanced with asObservable
and {un}subscribe
alike methods:
import { ReactiveMap } from 'rxjs-collection';
const reactiveMap : ReactiveMap<number, number> = new ReactiveMap<number, number>();
// subscribe to mutations
reactiveMap.asObservable().subscribe(map => map.has(1));
reactiveMap.subscribe(map => map.has(1));
// mutate the collection
reactiveMap.set(1, 1);
// unsubscribe from mutations
reactiveMap.unsubscribe();
Read the documentation for a deep dive.