1.1.2 • Published 9 years ago

ajaxretry v1.1.2

Weekly downloads
4
License
-
Repository
github
Last release
9 years ago

ajaxRetry

Exponentially retry $.ajax requests

 

Installation

npm install --save ajaxretry

 In your client app main.js, add the following line to default retry settings:

require('ajaxretry');

Or override any of the default settings using set: passing keyword arguments

require('ajaxretry').set({ y:0.3 });

 

Usage

The default settings are:

{
  base: 2.718281828,
  y: 0.25,
  retryCount: 3
}

 

For $.ajax requets (also shorthand $.get and .post), pass exhaust in the options object as a callback function to run when retries fail

  • please note that exhaust supersedes the error callback
  • if exhaust method is not passed, retries will end without further action
  • the returned jqXHR object has been extended with the ajax request options, thus allowing jqXHR.type, jqXHR.url, etcetera
$.ajax({
  url: '/test',
  type: 'GET',
  exhaust : function (jqXHR, textStatus, errorThrown) {
    // Handle Internal Server Error
  }
});

 




 

 

This module is a simplified version of backbone-ajaxretry by the same author.

1.1.2

9 years ago

1.1.1

9 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago