🔨 Invokes "fn1" until "limit" is reached after that call "fn2".
npm install wooden-ladder
let WoodenLadder = require('wooden-ladder');
let fn1 = () => console.log(1);
let fn2 = () => console.log(2);
let lad = new WoodenLadder(3, fn1, fn2);
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn2"
lad.climb(); // fired "fn2"
lad.climb(); // fired "fn2"
...
lad.climb(); // fired "fn2"
let WoodenLadder = require('wooden-ladder');
let fn1 = () => console.log(1);
let fn2 = () => {
console.log(2)
lad.reset();
};
let lad = new WoodenLadder(3, fn1, fn2);
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn2"
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn1"
lad.climb(); // fired "fn2"
lad.climb(); // fired "fn2"
lad.climb(); // fired "fn2"
...
lad.climb(); // fired "fn2"
The MIT License @ 2016