UNPKG

@push.rocks/lik

Version:

Provides a collection of lightweight helpers and utilities for Node.js projects.

47 lines (46 loc) 1.72 kB
import * as plugins from './classes.plugins.js'; import { InterestMap, type IInterestComparisonFunc } from './classes.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; private isDestroyed; /** * a generic store to store objects in that are needed for fullfillment; */ fullfillmentStore: any[]; /** * a cancellable timeout for the markLostAfterDefault feature */ private markLostTimeout; /** * 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; }