@snyk/dep-graph
Advanced tools
Comparing version 1.5.1 to 1.5.2
export declare class EventLoopSpinner { | ||
private thresholdMs; | ||
private lastSpin; | ||
private afterLastSpin; | ||
constructor(thresholdMs?: number); | ||
isStarving(): boolean; | ||
reset(): void; | ||
spin(): Promise<{}>; | ||
} |
@@ -8,12 +8,18 @@ "use strict"; | ||
this.thresholdMs = thresholdMs; | ||
this.lastSpin = Date.now(); | ||
this.afterLastSpin = Date.now(); | ||
} | ||
EventLoopSpinner.prototype.isStarving = function () { | ||
return (Date.now() - this.lastSpin) > this.thresholdMs; | ||
return (Date.now() - this.afterLastSpin) > this.thresholdMs; | ||
}; | ||
EventLoopSpinner.prototype.reset = function () { | ||
this.afterLastSpin = Date.now(); | ||
}; | ||
EventLoopSpinner.prototype.spin = function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return tslib_1.__generator(this, function (_a) { | ||
this.lastSpin = Date.now(); | ||
return [2 /*return*/, new Promise(function (resolve) { return setImmediate(resolve); })]; | ||
return [2 /*return*/, new Promise(function (resolve) { return setImmediate(function () { | ||
_this.reset(); | ||
resolve(); | ||
}); })]; | ||
}); | ||
@@ -20,0 +26,0 @@ }); |
@@ -49,3 +49,3 @@ { | ||
}, | ||
"version": "1.5.1" | ||
"version": "1.5.2" | ||
} |
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
61451
868