@push.rocks/lik
Version:
Provides a collection of lightweight helpers and utilities for Node.js projects.
48 lines (47 loc) • 1.66 kB
TypeScript
import * as plugins from './classes.plugins.js';
import { Interest } from './classes.interestmap.interest.js';
export type IInterestComparisonFunc<T> = (objectArg: T) => string;
export interface IInterestMapOptions {
markLostAfterDefault?: number;
}
export declare class InterestMap<DTInterestId, DTInterestFullfillment> {
options: IInterestMapOptions;
/**
* stores interests that are currently fullfilled by the cache
*/
private interestObjectMap;
/**
* a function to compare interests
*/
private comparisonFunc;
constructor(comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, optionsArg?: IInterestMapOptions);
/**
* adds an interest to the InterestMap
* @param interestId
*/
addInterest(interestId: DTInterestId, defaultFullfillmentArg?: DTInterestFullfillment): Promise<Interest<DTInterestId, DTInterestFullfillment>>;
interestObservable: plugins.smartrx.ObservableIntake<Interest<DTInterestId, any>>;
/**
* removes an interest from the interest map
*/
removeInterest(interestArg: Interest<DTInterestId, DTInterestFullfillment>): void;
/**
* check interest
*/
checkInterest(objectArg: DTInterestId): boolean;
/**
* checks an interest
* @param comparisonStringArg
*/
checkInterestByString(comparisonStringArg: string): boolean;
/**
* inform lost interest
* @param interestId
*/
informLostInterest(interestId: DTInterestId): void;
/**
* finds an interest
* @param interestId
*/
findInterest(interestId: DTInterestId): Interest<DTInterestId, DTInterestFullfillment>;
}