Skip to content

busterc/fib-interval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

🔁 setInterval using a series of incrementing Fibonacci durations

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published