My personal blog
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1.3 KiB

title author date template
Continuous NodeJS Module Brett Langdon 2012-04-28 article.jade

A look into my new NodeJS module called Continuous.


Greetings everyone. I wanted to take a moment to mention the new NodeJS module that I just published called Continuous.

Continuous is a fairly simply plugin that is aimed to aid in running blocks of code consistently; it is an event based interface for setTimeout and setInterval. With Continuous you can choose to run code at a set or random interval and can also hook into events.

Installation

npm install continuous

Continuous Usage

var continuous = require('continuous');

var run = new continuous({
    minTime: 1000,
    maxTime: 3000,
    random: true,
    callback: function(){
        return Math.round( new Date().getTime()/1000.0 );
    },
    limit: 5
});

run.on(complete, function(count, result){
    console.log(I have run  + count +  times);
    console.log(Results:);
    console.dir(result);
});

run.on(started, function(){
    console.log(I Started);
});

run.on(stopped, function(){
    console.log(I am Done);
});

run.start();

setTimeout( function(){
    run.stop();
}, 5000 );

For more information check out Continuous on GitHub.