@push.rocks/lik
Version:
Provides a collection of lightweight helpers and utilities for Node.js projects.
45 lines (44 loc) • 1.6 kB
TypeScript
import * as plugins from './lik.plugins.js';
import { InterestMap, type IInterestComparisonFunc } from './lik.interestmap.js';
export interface IInterestOptions<DTInterestFullfillment> {
markLostAfterDefault: number;
defaultFullfillment?: DTInterestFullfillment;
}
export declare class Interest<DTInterestId, DTInterestFullfillment> {
options: IInterestOptions<DTInterestFullfillment>;
private interestMapRef;
originalInterest: DTInterestId;
comparisonFunc: IInterestComparisonFunc<DTInterestId>;
destructionTimer: plugins.smarttime.Timer;
isFullfilled: boolean;
/**
* a generic store to store objects in that are needed for fullfillment;
*/
fullfillmentStore: any[];
/**
* quick access to a string that makes the interest comparable for checking for similar interests
*/
get comparisonString(): string;
private interestDeferred;
interestFullfilled: Promise<DTInterestFullfillment>;
/**
* fullfill the interest
*/
fullfillInterest(objectArg: DTInterestFullfillment): void;
/**
*
*/
constructor(interestMapArg: InterestMap<DTInterestId, DTInterestFullfillment>, interestArg: DTInterestId, comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, optionsArg?: IInterestOptions<DTInterestFullfillment>);
/**
* self destructs the interest
*/
destroy(): void;
/**
* notifies the interest that the interest in it has been lost
*/
markLost(): void;
/**
* notifies the interest that the interest in it has been restored
*/
renew(): void;
}