{"id":15357634,"url":"https://github.com/cvzi/requestqueue","last_synced_at":"2025-04-15T06:53:15.266Z","repository":{"id":146248956,"uuid":"75334479","full_name":"cvzi/RequestQueue","owner":"cvzi","description":"A simple queue for XMLHttpRequests or other async functions. Optimized for Greasemonkey GM_xmlhttpRequests","archived":false,"fork":false,"pushed_at":"2021-12-06T13:13:36.000Z","size":5,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T06:53:10.760Z","etag":null,"topics":["async","greasemonkey","xmlhttprequest"],"latest_commit_sha":null,"homepage":null,"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/cvzi.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-12-01T21:29:21.000Z","updated_at":"2023-08-15T06:03:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"39b4a005-045c-47b7-9e1a-e320d7ca29a5","html_url":"https://github.com/cvzi/RequestQueue","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.375,"last_synced_commit":"22ee7a9e614a1c3619d608b987e7efbddff5ea7e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvzi%2FRequestQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvzi%2FRequestQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvzi%2FRequestQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvzi%2FRequestQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cvzi","download_url":"https://codeload.github.com/cvzi/RequestQueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249023711,"owners_count":21199958,"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":["async","greasemonkey","xmlhttprequest"],"created_at":"2024-10-01T12:37:21.701Z","updated_at":"2025-04-15T06:53:15.246Z","avatar_url":"https://github.com/cvzi.png","language":"JavaScript","readme":"# RequestQueue\nA simple queue for XMLHttpRequests or other async functions. Optimized for Greasemonkey GM_xmlhttpRequests\n\n\n## Documentation\n\n```js\nnew RequestQueue([maxParallel[, maxTotal]])\n```\nCreate queue object\n * *maxParallel*\n   defaults to 1 i.e. no paralllel requests\n * *maxTotal*\n   defaults to unlimited\n\n---\n\n\n```js\nRequestQueue.prototype.add(req[, fun[, thisArg]])\n```\nSchedule a request\n* *req*\n  An object that is the only argument of fun. This will be extended and therefore must be mutable.\n  At least one of the following methods onload, onerror or onabort must be implemented.\n* *fun*\n  defaults to `GM_xmlhttpRequest`\n* *thisArg*\n  The value of this provided for the call to fun. Keep strict mode in mind!\n\nResults in a call like this: `thisArg.fun(req)`\n\n---\n\n\n```js\nRequestQueue.prototype.abortRunning()\n```\nAbort running requests\n\nFor all scheduled requests that are currently running: `result = thisArg.fun(req)`\nthis will call `result.abort()`\nFor GM_xmlhttpRequest this will subsequently fire an onabort event\n\n---\n\n\n```js\nRequestQueue.prototype.abortPending()\n```\nAbort pending requests\n\nClear the list of pending requests i.e. requests that were not sent yet.\n\n---\n\n\n```js\nRequestQueue.prototype.abort()\n```\nAbort both running and pending requests\n\n\n\n## Example\n\n```js\nvar rq = new RequestQueue(1); // 1 -\u003e Allow no parallel requests\nrq.add({\n  method: \"GET\",\n  url: \"http://www.example.org/page1\",\n  onload: function (response){\n    console.log(\"onload 1\");\n  }\n});\nrq.add({\n  method: \"GET\",\n  url: \"http://www.example.org/page2\",\n  onload: function (response){\n    console.log(\"onload 2\");\n  }\n});\n```\n\nThe request to page 1 will be sent immediately.\nThe request to page 2 will be sent after the the first request has finished, but before the first onload event is called.\n\n\n## Version history\n* Version 6\n * Support for Greasemonkey version 4 and Firefox version 57\n* Version 5\n * New methods: resetTotal(), hasReachedTotal(), hasRunning()\n* Version 4\n * Fix for XMLHttpRequest.abort() \n* Version 3\n * Fix for Chrome\n* Version 2\n * Fix for Firefox 36.0 \n* Version 1\n * initial version\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvzi%2Frequestqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcvzi%2Frequestqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvzi%2Frequestqueue/lists"}