loop-detection
Advanced tools
Comparing version 1.0.0 to 1.0.1
function LoopProtect() { | ||
this.counters = {} | ||
this.threshold = 500 | ||
} | ||
@@ -16,5 +17,6 @@ | ||
// TODO(ibash) make threshold configurable | ||
if ((now - current.time) > 100) { | ||
this.onHitCallback(current) | ||
if ((now - current.time) > this.threshold) { | ||
if (this.onHitCallback) { | ||
this.onHitCallback(current) | ||
} | ||
return true | ||
@@ -26,2 +28,6 @@ } | ||
LoopProtect.prototype.setThreshold = function setThreshold(threshold) { | ||
this.threshold = threshold | ||
} | ||
LoopProtect.prototype.onHit = function onHit(callback) { | ||
@@ -28,0 +34,0 @@ this.onHitCallback = callback |
{ | ||
"name": "loop-detection", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
7839
242