Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Throttle function calls
JavaScript Makefile
branch: master
Failed to load latest commit information.
.gitignore adding node_modules
History.md 1.0.0 release
Makefile adding tests
Readme.md Typo.
component.json v0.0.2
example.js Initial commit
index.js Tailing invocation support, & removing max argument, fixes #2
package.json 1.0.0 release
test.js Updating tests.

Readme.md

throttle

Throttle a function

Installation

$ component install component/throttle

Example

var throttle = require('throttle');
window.onresize = throttle(resize, 200);

function resize(e) {
  console.log('height', window.innerHeight);
  console.log('width', window.innerWidth);
}

API

throttle(fn, wait)

Creates a function that will call fn at most once every wait milliseconds.

Supports leading and trailing invocation.

fn will receive last context (this) and last arguments passed to a throttled wrapper before fn was invoked.

License

MIT

Something went wrong with that request. Please try again.