1.3.2 • Published 9 years ago

backbone-ajaxretry v1.3.2

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

Backbone.js ajaxRetry

Exponentially retry Backbone.ajax and $.ajax requests

 

Installation

npm install --save backbone-ajaxretry

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

require('backbone-ajaxretry');

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

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

 

Usage

The default settings are:

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

 

By default both Backbone.ajax and $.ajax Server Errors are retried. To only retry Backbone.ajax requests and not also regular $.ajax requests, change the onlyBackbone default setting to true.

For Backbone.js sync, fetch, save or destroy, 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
// Backbone ex.
myModel.fetch({
  exhaust : function (jqXHR, textStatus, errorThrown) {
    // Handle Internal Server Error
  }
});

// $.ajax ex.
$.ajax({
  url: '/test',
  type: 'GET',
  exhaust : function (jqXHR, textStatus, errorThrown) {
    // Handle Internal Server Error
  }
});

 




1.3.2

9 years ago

1.3.1

9 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.9

10 years ago

1.1.8

10 years ago

1.1.7

10 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago