Nifty Purring Manticore

    spidey-heart

    1.0.2 • Public • Published

    Spidey Heart

    Spidey heart is simple heartbeat library for managing event based actions.

    Getting started

    Install

    npm install spidey-heart

    Example

    var SpideyHeart = require("spidey-heart").SpideyHeart;
     
    var heartBeatDelay = 1000; // heart beat delay in milliseconds [1000ms = 1s]
     
    var myHeart = new SpideyHeart(heartBeatDelay); // instancing heart with 1s beat delay
     
    myHeart.every().add(function() {
        console.log("I'm called every second!");
    }, this);
     
    myHeart.every(3).add(function() {
        console.log("I'm called every 3 seconds!");
    }, this);
     
    myHeart.every(5).addOnce(function() {
        console.log("I'm called only once after 5 seconds!");
    }, this);

    NOTE: Second argument in add & addOnce methods is scope object for callback

    Install

    npm i spidey-heart

    DownloadsWeekly Downloads

    7

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • kalevski