{"id":16117740,"url":"https://github.com/technikhil314/backbone-http-interceptor","last_synced_at":"2025-10-14T16:05:54.509Z","repository":{"id":112560642,"uuid":"71977881","full_name":"technikhil314/backbone-http-interceptor","owner":"technikhil314","description":"Simple Ajax interceptor for backbonejs based frameworks","archived":false,"fork":false,"pushed_at":"2020-06-23T08:35:39.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T16:04:36.474Z","etag":null,"topics":["ajax","backbone","backbone-applications","backbone-marionette","backbonejs","http-interception","http-interceptor","http-interceptors","javascript","jquery"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/technikhil314.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-26T07:33:37.000Z","updated_at":"2021-09-10T06:30:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3269a24-8351-46cc-aba5-e94770b25a2c","html_url":"https://github.com/technikhil314/backbone-http-interceptor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/technikhil314/backbone-http-interceptor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technikhil314%2Fbackbone-http-interceptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technikhil314%2Fbackbone-http-interceptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technikhil314%2Fbackbone-http-interceptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technikhil314%2Fbackbone-http-interceptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/technikhil314","download_url":"https://codeload.github.com/technikhil314/backbone-http-interceptor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technikhil314%2Fbackbone-http-interceptor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019554,"owners_count":26086750,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ajax","backbone","backbone-applications","backbone-marionette","backbonejs","http-interception","http-interceptor","http-interceptors","javascript","jquery"],"created_at":"2024-10-09T20:46:43.400Z","updated_at":"2025-10-14T16:05:54.480Z","avatar_url":"https://github.com/technikhil314.png","language":"JavaScript","readme":"# backbone-http-interceptor\r\nit is a general purpose ajax interceptor for backbone and backbone.marionette framework or any other framework which is build on top of backbone.js.\u003cbr/\u003e\r\nUsing this project you can intercept every ajax request which is fired using backbone models/collections fetch/save method.\u003cbr/\u003e\r\nDuring interceptions we given you some default options as below to show/hide spinner/toaster. By modifying the cource code you can also add your custom headers to your request/response.\u003cbr/\u003e\r\n\r\nSee example for more information.\r\n\r\n# Installation\r\nsimply include this plugin after everything is loaded except your files\r\n```\r\n\u003cscript src=\"https://code.jquery.com/jquery-3.1.1.js\"\u003e\u003c/script\u003e\r\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js\"\u003e\u003c/script\u003e\r\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.3.3/backbone.js\"\u003e\u003c/script\u003e\r\n\u003cscript src=\"http://rawgit.com/nikhil-001mehta/backbone-http-interceptor/master/release/backbone.httpInterceptor.min.js\"\u003e\u003c/script\u003e\r\n```\r\n\r\n# Usage\r\n```\r\nvar backboneInterceptor = new Backbone.HttpInterceptor\r\n\t\t\tbackboneInterceptor.start(options object);\r\n```\r\n\r\n## available options are\r\n```\r\noptions = {\r\n\t\t\tspinnerSelector: 'unique selector for showing/hiding the spinner during ajax request is in progress',\r\n\t\t\tspinnerTextSelector: 'unique selector to show text in spinner i.e. saving/loading/processing etc',\r\n\t\t\tdefaultSpinnerText: 'Texr to show in spinner when nothing is paased in options to backbone.fetch/backbone.save'\r\n\t\t\tspinnerDisplayStyle: 'block/flex/inline etc'\r\n\t\t\ttoasterSelector: 'unique selector for showing/hiding the spinner after ajax request is processed',\r\n\t\t\ttoasterTextSelector: 'unique selector to show text in toaster',\r\n\t\t\tdefaultToasterText: 'Texr to show in toaster when nothing is paased in options to backbone.fetch/backbone.save'\r\n\t\t\ttoasterDisplayStyle: 'block/flex/inline etc'\r\n\t\t\ttoasterSuccessClass: 'class to apply to toasterSelector when ajax request is succeeds',\r\n\t\t\ttoasterErrorClass: 'class to apply to toasterSelector when ajax request is fails',\r\n\t\t };\r\n```\r\n\r\nafter installation simply call fetch/save method you can see spinner/toaster as per your options\r\n```\r\nvar todoModel = new Backbone.Model({\r\n\turl: \"http://jsonplaceholder.typicode.com/posts\",\r\n});\r\ntodoModel.fetch();\r\n```\r\n\r\nYou can also supress spinner and toaster for some specific fetch/save calls as shown below\r\n```\r\nvar todoModel = new Backbone.Model({\r\n\turl: \"http://jsonplaceholder.typicode.com/posts\"\r\n});\r\ntodoModel.fetch({\r\n\tdoNotshowSpinner: true,\r\n\tdoNotshowToaster: true\r\n});\r\n```\r\nyou can abort all pending requests using\r\n```\r\nbackboneInterceptor.abortAllPendingRequests();\r\n```\r\nyou can tell interceptor not to abort the request during abortAllPendingRequests() process\r\n```\r\nvar todoModel = new Backbone.Model({\r\n\turl: \"http://jsonplaceholder.typicode.com/posts\"\r\n});\r\ntodoModel.fetch({\r\n\tdoNotAbort: true\r\n});\r\ntodoModel.fetch();\r\nbackboneInterceptor.abortAllPendingRequests();\r\n```\r\nthis will abort only second request\r\n\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnikhil314%2Fbackbone-http-interceptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechnikhil314%2Fbackbone-http-interceptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnikhil314%2Fbackbone-http-interceptor/lists"}