hrms-manual/node_modules/throttleit
2023-09-06 14:51:44 +07:00
..
.npmignore first commit 2023-09-06 14:51:44 +07:00
component.json first commit 2023-09-06 14:51:44 +07:00
example.js first commit 2023-09-06 14:51:44 +07:00
History.md first commit 2023-09-06 14:51:44 +07:00
index.js first commit 2023-09-06 14:51:44 +07:00
Makefile first commit 2023-09-06 14:51:44 +07:00
package.json first commit 2023-09-06 14:51:44 +07:00
Readme.md first commit 2023-09-06 14:51:44 +07:00
test.js first commit 2023-09-06 14:51:44 +07:00

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