fps-throttler

1.0.2 • Public • Published

FPS Throttler

Throttle function call excatly to specific number times during one second - fps limit (by using requestAnimationFrame).

Example:

const Throttler = require('fps-throttler');
const throttler = new Throttler(() => {}, 10);

This will call function 10 times per second (max limit is 60 - according to requestAnimationFrame specification).

Usage

Create new throttler:

const Throttler = require('fps-throttler');
const throttler = new Throttler(callback, fpsLimit);

For ecmascript module use:

import Throttler from './node_modules/src/fps-throttler/throttler.esm.js';

Start:

throttler.start();

Stop:

throttler.stop();

Change fps limit

throttler.limit(fps);

Change callback

throttler.callback(callable);

Readme

Keywords

Package Sidebar

Install

npm i fps-throttler

Weekly Downloads

1

Version

1.0.2

License

Apache License 2.0

Last publish

Collaborators

  • ranmus