{"id":21258906,"url":"https://github.com/microfleet/callback-queue","last_synced_at":"2025-07-11T02:32:57.194Z","repository":{"id":38425947,"uuid":"32422987","full_name":"microfleet/callback-queue","owner":"microfleet","description":"Put your callbacks into queue to make sure that concurrent requests that you might want to perform will only be executed once","archived":false,"fork":false,"pushed_at":"2025-01-19T06:17:25.000Z","size":927,"stargazers_count":3,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-02T10:59:45.882Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/microfleet.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-17T22:05:09.000Z","updated_at":"2025-01-19T06:14:12.000Z","dependencies_parsed_at":"2025-02-28T07:11:43.861Z","dependency_job_id":"39558488-f23f-407c-9f65-4502b57fceae","html_url":"https://github.com/microfleet/callback-queue","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.4,"last_synced_commit":"cafa30d7baa2a1a970befffe5dd3e4b19b95a789"},"previous_names":["avvs/callback-queue"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/microfleet/callback-queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fcallback-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fcallback-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fcallback-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fcallback-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microfleet","download_url":"https://codeload.github.com/microfleet/callback-queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fcallback-queue/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260263612,"owners_count":22982746,"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-21T04:11:25.414Z","updated_at":"2025-07-11T02:32:56.900Z","avatar_url":"https://github.com/microfleet.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Callback queue\n\n[![Codacy Badge](https://www.codacy.com/project/badge/a8696114e713425083cdd7cd2d44db34)](https://www.codacy.com/app/v/callback-queue)\n\nNode.js callback queue. Can be used with browserify as well.\n\nIdea is to queue callbacks, when same function wants to be called at the same time\nby different callers.\n\nOne example would be conserving resources spent on outgoing http requests.\n\n`npm install callback-queue -S`\n\n## Example usage\n\n1. `callbackQueue.add(String, Function)`: queues callbacks based on key attribute\n2. `callbackQueue.remove(String, Error)`: calls queued callbacks with Error argument\n\n```js\nconst callbackQueue = require('callback-queue');\nconst request = require('request');\n\nfunction performOutgoingRequest(url, next) {\n  const callback = callbackQueue.add(url, next);\n  if (!callback) {\n    return;\n  }\n\n  request(url, callback);\n}\n\nfor (let i = 0; i \u003c 100; i++) {\n  // request itself will be performed just once\n  performOutgoingRequest('https://google.com', function niceCallback(err, resp, body) {\n    // will be called 100 times\n  });\n}\n\nfor (let x = 0; x \u003c 100; x++) {\n  // request itself will be performed just once\n  performOutgoingRequest('https://google.com', function niceCallback(err, resp, body) {\n      // will be called 100 times with Error object\n  });\n}\n\ncallbackQueue.remove('https://google.com', new Error('cancel it!'));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrofleet%2Fcallback-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrofleet%2Fcallback-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrofleet%2Fcallback-queue/lists"}