{"id":19343059,"url":"https://github.com/gdibble/backbone-ajaxretry","last_synced_at":"2025-04-23T04:35:34.420Z","repository":{"id":15718139,"uuid":"18456215","full_name":"gdibble/backbone-ajaxretry","owner":"gdibble","description":"Exponentially retry Backbone.ajax \u0026 $.ajax requests","archived":false,"fork":false,"pushed_at":"2015-06-01T10:37:12.000Z","size":268,"stargazers_count":5,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-02T17:07:40.554Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gdibble.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-05T00:05:11.000Z","updated_at":"2021-01-15T01:32:21.000Z","dependencies_parsed_at":"2022-09-01T09:51:12.727Z","dependency_job_id":null,"html_url":"https://github.com/gdibble/backbone-ajaxretry","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdibble%2Fbackbone-ajaxretry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdibble%2Fbackbone-ajaxretry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdibble%2Fbackbone-ajaxretry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdibble%2Fbackbone-ajaxretry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gdibble","download_url":"https://codeload.github.com/gdibble/backbone-ajaxretry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223910075,"owners_count":17223591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:37:13.890Z","updated_at":"2024-11-10T03:37:14.540Z","avatar_url":"https://github.com/gdibble.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backbone.js ajaxRetry\n\n#### Exponentially retry Backbone.ajax and $.ajax requests\n\n\u0026nbsp;\n\n## Installation\n\n```\nnpm install --save backbone-ajaxretry\n```\n\n\u0026nbsp;\u003cbr\u003eIn your client app `main.js`, add the following line to default retry settings:\n\n```javascript\nrequire('backbone-ajaxretry');\n```\n\nOr override any of the default settings using `set`: passing keyword arguments\n\n```javascript\nrequire('backbone-ajaxretry').set({ y:0.3 });\n```\n\n\u0026nbsp;\n\n## Usage\nThe default settings are:\n\n```javascript\n{\n  base: 2.718281828,\n  y: 0.25,\n  retryCount: 3,\n  onlyBackbone: false\n}\n```\n\n\u0026nbsp;\n\nBy default both `Backbone.ajax` and `$.ajax` [Server Errors](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_Server_Error) are retried. To only retry `Backbone.ajax` requests and not also [regular] `$.ajax` requests, change the `onlyBackbone` default setting to `true`.\n\nFor Backbone.js sync, fetch, save or destroy, pass `exhaust` in the options object as a callback function to run when retries fail\n  * please note that `exhaust` supersedes the `error` callback\n  * if `exhaust` method is not passed, retries will end without further action\n  * the returned `jqXHR` object has been extended with the ajax request options, \u003cbr\u003ethus allowing `jqXHR.type`, `jqXHR.url`, etcetera\n\n```javascript\n// Backbone ex.\nmyModel.fetch({\n  exhaust : function (jqXHR, textStatus, errorThrown) {\n    // Handle Internal Server Error\n  }\n});\n\n// $.ajax ex.\n$.ajax({\n  url: '/test',\n  type: 'GET',\n  exhaust : function (jqXHR, textStatus, errorThrown) {\n    // Handle Internal Server Error\n  }\n});\n```\n\u0026nbsp;\n\n---\n\n* **Changelog \u0026gt;\u0026gt;\u0026gt;** [releases](https://github.com/gdibble/backbone-ajaxretry/releases)\n\n---\n\n* **Dependency:** [Underscore.js](http://underscorejs.org/)\n  * ***Implied:***\n    * [Backbone.js](http://backbonejs.org)\n      * [jQuery](http://jquery.com), [zepto.js](http://zeptojs.com), [ENDER](http://ender.jit.su) **or** even your own `$` library *which defines `$.ajax`*\n\n---\n\n* [npmjs.org/package/backbone-ajaxretry](https://www.npmjs.org/package/backbone-ajaxretry)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdibble%2Fbackbone-ajaxretry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgdibble%2Fbackbone-ajaxretry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdibble%2Fbackbone-ajaxretry/lists"}