class Limiter { constructor(info) { this.countThreshold = info.countThreshold; this.timeThreshold = info.timeThreshold; this.nextTime = 0; this.time = 0; this.count = 0; }; update() { if (performance.now() - this.time < this.timeThreshold) this.count++; else { this.time = performance.now(); this.count = 1; }; return this.count > this.countThreshold; } }; module.exports = Limiter;