class HitCounter { constructor(count,cb) { this.count=count; this.cb = cb; } hit() { this.count--; if(this.count == 0) { this.cb(); } } } module.exports = HitCounter;