Skip to content

generating a counter by rules and trigger when reach the limit

Notifications You must be signed in to change notification settings

zephyrpersonal/rate-limiting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RATE-LIMITING

simple counter fires callback when reach limit

npm install rate-limiting-counter -S
const Counter = require('rate-limiting-counter')

const counter = new Counter({
  interval: 1000 // every seconds to reset inner count,
  max: 100 // max count in one loop,
  onReachLimit: () => {} // callback when hit limit in one loop,
  autoStart: true // if start the counter loop when constructor has called
})

counter.add() // add 1 to inner count
counter.stop() // stop counter
counter.resume() // resume counter

About

generating a counter by rules and trigger when reach the limit

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published