fib-interval

1.0.0 • Public • Published

fib-interval NPM version Build Status

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

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i fib-interval

    Weekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Last publish

    Collaborators

    • buster