Skip to content

aviramst/stubborn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stubborn

Install

npm install stubborn

Example

var Stubborn = require('stubborn');

var options = {
  maxAttempts: 5,
  delay: 1000
};

var stubborn = new Stubborn(task, options, callback);

stubborn.on('error', onError);

stubborn.run();

function task(callback) {
  if (Math.random() > 0.2) {
    callback('Task error');
  } else {
    callback(null, 'Task result');
  }
}

function callback(err, result) {
  if (err) {
    console.error(err);
    return;
  }
  console.log(result);
}

function onError(err) {
  console.error(err);
}

Events

  • run
  • error
  • schedule
  • maxAttempts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%