throttleme

v1.0.3
simple throttling
throttle rate-limit util

throttleme

NPM

Usage

var throttle = require('throttleme')
var now = Date.now()

var fast = function (/* whatever args */) {
  console.log(Date.now() - now)
}

var slow = throttle(fast, 200)

// Note: you won't get exactly 0, 200, etc, because this module 
// uses setTimeout, which is inaccurate (and this module isn't that sophisticated)
// Expect something like ~20ms accuracy

slow() // -> 0
slow() // -> 200
slow() // -> 400
slow() // -> etc.
npm i throttleme

Metadata

  • ISC
  • Whatever
  • Mark Vayngrib
  • released 9/4/2015

Downloads

Maintainers