@constructorfleet/ultimate-govee
Version:
Library for interacting with Govee devices written in Typescript.
90 lines • 2.98 kB
TypeScript
import { DeltaMapSettings, IsModified, MapDelta } from './types';
export declare class DeltaMap<K, V> extends Map<K, V> {
private deltaSubject$;
delta$: import("rxjs").Observable<MapDelta<K, V>>;
private added;
private deleted;
private modified;
private existedBeforeDelta?;
private publishEmpty;
private publish;
private copyAll;
protected isUpdated?: IsModified<V>;
constructor();
constructor(entries: Iterable<Iterable<any>>);
constructor(settings?: DeltaMapSettings<V>);
constructor(entries: Iterable<Iterable<any>>, settings?: DeltaMapSettings<V>);
/**
* Process constructor content, can be overriden and extended in subclasses
*/
protected initializeContent(entries: Iterable<any>): void;
/**
* Process constructor settings, can be overriden and extended in subclasses
*/
protected initializeSettings(settings: DeltaMapSettings<V>): void;
/**
* Publish modification to delta$ if there are changes or if it is the first time called.
*/
protected publishDelta(): void;
/**
* @returns _true_ if the ObservableMap _delta$_ has subscribers
*/
get observed(): boolean;
/**
* Pauses and combines all delta updates until _resumeDelta_ is called.
*/
pauseDelta(): void;
/**
* Publishes all pending _added_, _modified_ or _deleted_ entries if there are any.
*/
resumeDelta(): void;
/**
* Return current value of the delta
*/
getDelta(): MapDelta<K, V>;
/**
* Clears the current delta without publishing updates to subscribers.
*
* WARNING: This method can mess up publication integrity,
* only use in DeltaMaps without subscriptions.
*/
clearDelta(): void;
/**
* Adds or modifies an entry and notifies changes through _delta$_.
*
* If an existing entry is the same according to the _compare_ function, nothing is changed
* @override
*/
set(id: K, value: V): any;
/**
* _set_ delta logic.
* Determines if it is an _add_ or a _modify_ and updates the delta.
* Can be extended and/or overridden in subclasses
*/
protected doSet(id: K, value: V): void;
/**
* Deletes an entry and notifies deletions through _delta$_ if the entry exists.
* @override
*/
delete(id: K): boolean;
/**
* _delete_ delta logic.
* Determines if it exists and updates the delta.
* Can be extended and/or overridden in subclasses
*/
protected doDelete(id: K): boolean;
/**
* Deletes multiple entries at once and notifies changes through _delta$_.
*/
deleteMultiple(entrieIds: Iterable<K>): void;
/**
* Clears all entries and notifies deletions through _delta$_.
* @override
*/
clear(): any;
/**
* Clears any remaining entries and completes the delta$ observable
*/
close(): void;
}
//# sourceMappingURL=delta-map.observable.d.ts.map