@pushrocks/lik
Advanced tools
Comparing version 4.0.14 to 4.0.15
import * as plugins from './lik.plugins'; | ||
import { Interest } from './lik.interestmap.interest'; | ||
export declare type IInterestComparisonFunc<T> = (objectArg: T) => string; | ||
export interface IInterestMapOptions { | ||
markLostAfterDefault?: number; | ||
} | ||
export declare class InterestMap<DTInterestId, DTInterestFullfillment> { | ||
options: IInterestMapOptions; | ||
/** | ||
@@ -13,3 +17,3 @@ * stores interests that are currently fullfilled by the cache | ||
private comparisonFunc; | ||
constructor(comparisonFuncArg: IInterestComparisonFunc<DTInterestId>); | ||
constructor(comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, optionsArg?: IInterestMapOptions); | ||
/** | ||
@@ -16,0 +20,0 @@ * adds an interest to the InterestMap |
import * as plugins from './lik.plugins'; | ||
import { InterestMap, IInterestComparisonFunc } from './lik.interestmap'; | ||
export interface IInterestOptions { | ||
markLostAfterDefault: number; | ||
} | ||
export declare class Interest<DTInterestId, DTInterestFullfillment> { | ||
options: IInterestOptions; | ||
private interestMapRef; | ||
@@ -26,3 +30,3 @@ originalInterest: DTInterestId; | ||
*/ | ||
constructor(interestMapArg: InterestMap<DTInterestId, DTInterestFullfillment>, interestArg: DTInterestId, comparisonFuncArg: IInterestComparisonFunc<DTInterestId>); | ||
constructor(interestMapArg: InterestMap<DTInterestId, DTInterestFullfillment>, interestArg: DTInterestId, comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, optionsArg?: IInterestOptions); | ||
/** | ||
@@ -29,0 +33,0 @@ * self destructs the interest |
@@ -28,3 +28,4 @@ "use strict"; | ||
*/ | ||
constructor(interestMapArg, interestArg, comparisonFuncArg) { | ||
constructor(interestMapArg, interestArg, comparisonFuncArg, optionsArg) { | ||
var _a; | ||
this.destructionTimer = new plugins.smarttime.Timer(10000); | ||
@@ -38,8 +39,12 @@ this.isFullfilled = false; | ||
this.interestFullfilled = this.interestDeferred.promise; | ||
this.interestMapRef = interestMapArg; | ||
this.originalInterest = interestArg; | ||
this.comparisonFunc = comparisonFuncArg; | ||
this.interestMapRef = interestMapArg; | ||
this.options = optionsArg; | ||
this.destructionTimer.completed.then(() => { | ||
this.destroy(); | ||
}); | ||
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.markLostAfterDefault) { | ||
plugins.smartdelay.delayFor(this.options.markLostAfterDefault).then(this.markLost); | ||
} | ||
} | ||
@@ -83,2 +88,2 @@ /** | ||
exports.Interest = Interest; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLmludGVyZXN0bWFwLmludGVyZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbGlrLmludGVyZXN0bWFwLmludGVyZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSx1REFBeUM7QUFJekMsTUFBYSxRQUFRO0lBaUNuQjs7T0FFRztJQUNILFlBQ0UsY0FBaUUsRUFDakUsV0FBeUIsRUFDekIsaUJBQXdEO1FBbkNuRCxxQkFBZ0IsR0FBRyxJQUFJLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ3RELGlCQUFZLEdBQUcsS0FBSyxDQUFDO1FBRTVCOztXQUVHO1FBQ0ksc0JBQWlCLEdBQVUsRUFBRSxDQUFDO1FBUzdCLHFCQUFnQixHQUVwQixJQUFJLE9BQU8sQ0FBQyxZQUFZLENBQUMsUUFBUSxFQUFFLENBQUM7UUFDakMsdUJBQWtCLEdBQUcsSUFBSSxDQUFDLGdCQUFnQixDQUFDLE9BQU8sQ0FBQztRQW1CeEQsSUFBSSxDQUFDLGdCQUFnQixHQUFHLFdBQVcsQ0FBQztRQUNwQyxJQUFJLENBQUMsY0FBYyxHQUFHLGlCQUFpQixDQUFDO1FBQ3hDLElBQUksQ0FBQyxjQUFjLEdBQUcsY0FBYyxDQUF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ENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsQ0FBQztTQUNwRjtJQUNILENBQUM7SUF6Q0Q7O09BRUc7SUFDSCxJQUFXLGdCQUFnQjtRQUN6QixPQUFPLElBQUksQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFDcEQsQ0FBQztJQU9EOztPQUVHO0lBQ0ksZ0JBQWdCLENBQUMsU0FBaUM7UUFDdkQsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUM7UUFDekIsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEVBQUUsQ0FBQztRQUM1QixJQUFJLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQzNDLENBQUM7SUF3QkQsa0NBQWtDO0lBQ2xDLHVCQUF1QjtJQUN2QixrQ0FBa0M7SUFFbEM7O09BRUc7SUFDSSxPQUFPO1FBQ1osSUFBSSxDQUFDLGNBQWMsQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDM0MsQ0FBQztJQUVEOztPQUVHO0lBQ0ksUUFBUTtRQUNiLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUNoQyxDQUFDO0lBRUQ7O09BRUc7SUFDSSxLQUFLO1FBQ1YsSUFBSSxDQUFDLGdCQUFnQixDQUFDLEtBQUssRUFBRSxDQUFDO0lBQ2hDLENBQUM7Q0FDRjtBQWpGRCw0QkFpRkMifQ== |
@@ -27,3 +27,3 @@ "use strict"; | ||
class InterestMap { | ||
constructor(comparisonFuncArg) { | ||
constructor(comparisonFuncArg, optionsArg = {}) { | ||
/** | ||
@@ -36,2 +36,3 @@ * stores interests that are currently fullfilled by the cache | ||
this.comparisonFunc = comparisonFuncArg; | ||
this.options = optionsArg; | ||
} | ||
@@ -45,3 +46,5 @@ /** | ||
let returnInterest; | ||
const newInterest = new lik_interestmap_interest_1.Interest(this, objectArg, this.comparisonFunc); | ||
const newInterest = new lik_interestmap_interest_1.Interest(this, objectArg, this.comparisonFunc, { | ||
markLostAfterDefault: this.options.markLostAfterDefault | ||
}); | ||
let interestExists = false; | ||
@@ -117,2 +120,2 @@ await this.interestObjectMap.forEach((interestArg) => { | ||
exports.InterestMap = InterestMap; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLmludGVyZXN0bWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbGlrLmludGVyZXN0bWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSx1REFBeUM7QUFDekMsbURBQTRDO0FBSTVDLHlFQUFzRDtBQUl0RCxNQUFhLFdBQVc7SUFXdEIsWUFBWSxpQkFBd0Q7UUFWcEU7O1dBRUc7UUFDSyxzQkFBaUIsR0FBRyxJQUFJLHlCQUFTLEVBQWtELENBQUM7UUEwQzVGLDJDQUEyQztRQUNwQyx1QkFBa0IsR0FBRyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsZ0JBQWdCLEVBQStCLENBQUM7UUFuQzlGLElBQUksQ0FBQyxjQUFjLEdBQUcsaUJBQWlCLENBQUM7SUFDMUMsQ0FBQztJQUVEOzs7T0FHRztJQUNJLEtBQUssQ0FBQyxXQUFXLENBQ3RCLFNBQXVCO1FBRXZCLE1BQU0sZ0JBQWdCLEdBQUcsSUFBSSxDQUFDLGNBQWMsQ0FBQyxTQUFTLENBQUMsQ0FBQztRQUN4RCxJQUFJLGNBQThELENBQUM7UUFDbkUsTUFBTSxXQUFXLEdBQUcsSUFBSSxtQ0FBUSxDQUM5QixJQUFJLEVBQ0osU0FBUyxFQUNULElBQUksQ0FBQyxjQUFjLENBQ3BCLENBQUM7UUFDRixJQUFJLGNBQWMsR0FBRyxLQUFLLENBQUM7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R0MifQ== |
{ | ||
"name": "@pushrocks/lik", | ||
"version": "4.0.14", | ||
"version": "4.0.15", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "light little helpers for node", |
@@ -5,3 +5,9 @@ import * as plugins from './lik.plugins'; | ||
export interface IInterestOptions { | ||
markLostAfterDefault: number; | ||
} | ||
export class Interest<DTInterestId, DTInterestFullfillment> { | ||
public options: IInterestOptions; | ||
private interestMapRef: InterestMap<DTInterestId, DTInterestFullfillment>; | ||
@@ -45,10 +51,16 @@ public originalInterest: DTInterestId; | ||
interestArg: DTInterestId, | ||
comparisonFuncArg: IInterestComparisonFunc<DTInterestId> | ||
comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, | ||
optionsArg?: IInterestOptions | ||
) { | ||
this.interestMapRef = interestMapArg; | ||
this.originalInterest = interestArg; | ||
this.comparisonFunc = comparisonFuncArg; | ||
this.interestMapRef = interestMapArg; | ||
this.options = optionsArg; | ||
this.destructionTimer.completed.then(() => { | ||
this.destroy(); | ||
}); | ||
if (this.options?.markLostAfterDefault) { | ||
plugins.smartdelay.delayFor(this.options.markLostAfterDefault).then(this.markLost); | ||
} | ||
} | ||
@@ -55,0 +67,0 @@ |
@@ -10,3 +10,9 @@ import * as plugins from './lik.plugins'; | ||
export interface IInterestMapOptions { | ||
markLostAfterDefault?: number; | ||
} | ||
export class InterestMap<DTInterestId, DTInterestFullfillment> { | ||
public options: IInterestMapOptions; | ||
/** | ||
@@ -22,4 +28,5 @@ * stores interests that are currently fullfilled by the cache | ||
constructor(comparisonFuncArg: IInterestComparisonFunc<DTInterestId>) { | ||
constructor(comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, optionsArg: IInterestMapOptions = {}) { | ||
this.comparisonFunc = comparisonFuncArg; | ||
this.options = optionsArg; | ||
} | ||
@@ -39,3 +46,6 @@ | ||
objectArg, | ||
this.comparisonFunc | ||
this.comparisonFunc, | ||
{ | ||
markLostAfterDefault: this.options.markLostAfterDefault | ||
} | ||
); | ||
@@ -42,0 +52,0 @@ let interestExists = false; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1558353
14007