fib-interval
v1.0.0
Published
setInterval using a series of incrementing Fibonacci durations
Downloads
4
Maintainers
Readme
fib-interval
setInterval using a series of incrementing Fibonacci durations
Install
$ npm install --save fib-interval
Usage
- Unlike
setInterval
- The delay provided must be a numeric Array with the first 2 values to use
- To stop a timer you must call
.clear()
on the instance - To snoop out the current delay time, call
.delay()
on the instance
For Example:
'use strict';
var fibInterval = require('fib-interval');
// fibInterval(Function, [Number, Number]) : Object
var instance = fibInterval(function () {
var delay = instance.delay();
console.log(delay);
if (delay === 800) {
instance.clear();
console.log('fatto');
}
}, [0, 100]);
// ==> results:
// 0
// 100
// 100
// 200
// 300
// 500
// 800
// fatto
License
ISC © Buster Collings