Socket
Socket
Sign inDemoInstall

ajaxretry

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajaxretry

Exponentially retry $.ajax requests


Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

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
  }
});

 


  • Changelog >>> releases


 

 

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

Keywords

FAQs

Package last updated on 01 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc