time-accumulator
Call a function at a constant rate no matter what the rate the accumulator is called at.
Last updated 6 years ago by ericlathrop .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install time-accumulator 
SYNC missed versions from official npm registry.

time-accumulator

Call a function at a constant rate no matter what the rate the accumulator is called at.

Example

This causes the render function to be called every 5 milliseconds no matter what rate requestAnimationFrame calls accum at:

var timeAccumulator = require("time-accumulator");
var accum = timeAccumulator(5.0);

var render = function(elapsed) { /* ... */ };

window.requestAnimationFrame(function(elapsed) {
	accum(elapsed, render);
});

Install

With npm do:

npm install time-accumulator

License

MIT

Current Tags

  • 0.0.0                                ...           latest (6 years ago)

1 Versions

  • 0.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |