wooden-ladder

    1.1.1 • Public • Published

    wooden-ladder (npm)

    npm version Travis Coverage Status

    🔨 Invokes "fn1" until "limit" is reached after that call "fn2".

    Install

    $ npm install wooden-ladder
    

    Usage

    Example 1 (only climb)

    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"

    Example 2 (with reset)

    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"

    License

    The MIT License @ 2016

    Install

    npm i wooden-ladder

    DownloadsWeekly Downloads

    5

    Version

    1.1.1

    License

    MIT

    Last publish

    Collaborators

    • piecioshka