{"id":15509574,"url":"https://github.com/huan/rx-queue","last_synced_at":"2025-09-02T04:05:49.639Z","repository":{"id":45984383,"uuid":"107433841","full_name":"huan/rx-queue","owner":"huan","description":"Easy to Use RxJS Queue for Throttle/Debounce/Delay/DelayExecute","archived":false,"fork":false,"pushed_at":"2022-03-24T02:15:58.000Z","size":380,"stargazers_count":76,"open_issues_count":8,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-25T20:17:09.580Z","etag":null,"topics":["concurrency","executer","ixjs","queue","rxjs"],"latest_commit_sha":null,"homepage":"https://paka.dev/npm/rx-queue","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huan.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":"2017-10-18T16:24:43.000Z","updated_at":"2025-08-20T07:24:06.000Z","dependencies_parsed_at":"2022-09-01T13:01:19.095Z","dependency_job_id":null,"html_url":"https://github.com/huan/rx-queue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/huan/rx-queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huan%2Frx-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huan%2Frx-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huan%2Frx-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huan%2Frx-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huan","download_url":"https://codeload.github.com/huan/rx-queue/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huan%2Frx-queue/sbom","scorecard":{"id":471469,"data":{"date":"2025-08-11","repo":{"name":"github.com/huan/rx-queue","commit":"b99ceee1f8162c8f6b0aae2ddb52263acf2ba8ff"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/huan/rx-queue/npm.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/huan/rx-queue/npm.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/huan/rx-queue/npm.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/huan/rx-queue/npm.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/huan/rx-queue/npm.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/huan/rx-queue/npm.yml/main?enable=pin","Warn: npmCommand not pinned by hash: scripts/npm-pack-testing.sh:15","Warn: npmCommand not pinned by hash: .github/workflows/npm.yml:28","Warn: npmCommand not pinned by hash: .github/workflows/npm.yml:45","Warn: npmCommand not pinned by hash: .github/workflows/npm.yml:67","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/npm.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T13:59:13.813Z","repository_id":45984383,"created_at":"2025-08-19T13:59:13.813Z","updated_at":"2025-08-19T13:59:13.813Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273227970,"owners_count":25067691,"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-09-02T02:00:09.530Z","response_time":77,"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":["concurrency","executer","ixjs","queue","rxjs"],"created_at":"2024-10-02T09:43:17.210Z","updated_at":"2025-09-02T04:05:49.598Z","avatar_url":"https://github.com/huan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RX-QUEUE\n\n[![NPM](https://github.com/huan/rx-queue/actions/workflows/npm.yml/badge.svg)](https://github.com/huan/rx-queue/actions/workflows/npm.yml)\n[![Windows Build status](https://img.shields.io/appveyor/ci/zixia/rx-queue/master.svg?label=Windows)](https://ci.appveyor.com/project/zixia/rx-queue)\n[![NPM Version](https://badge.fury.io/js/rx-queue.svg)](https://badge.fury.io/js/rx-queue)\n[![Downloads](http://img.shields.io/npm/dm/rx-queue.svg?style=flat-square)](https://npmjs.org/package/rx-queue)\n[![Powered by TypeScript](https://img.shields.io/badge/Powered%20By-TypeScript-blue.svg)](https://www.typescriptlang.org/)\n\nEasy to Use ReactiveX Queue that Supports Delay/DelayExecutor/Throttle/Debounce Features Powered by RxJS.\n\n![RxQueue](https://huan.github.io/rx-queue/images/queue.png)\n\u003e Picture Credit: [Queues in JavaScript](https://www.kirupa.com/html5/queues_in_javascript.htm)\n\n## API\n\n### Class\n\n1. [RxQueue](#rxqueue)\n1. [DelayQueue](#delayqueue)\n1. [ThrottleQueue](#throttlequeue)\n1. [DebounceQueue](#debouncequeue)\n1. [DelayQueueExecutor](#DelayQueueExecutor)\n\n### Function\n\n1. [concurrencyExecuter()](#concurrencyexecuter)\n\n### RxQueue\n\n`RxQueue` is the base class of all other queues. It extends from RxJS Subject.\n\n**Example:**\n\n```ts\nimport { RxQueue } from 'rx-queue'\n\nconst queue = new RxQueue()\nqueue.next(1)\nqueue.next(2)\nqueue.next(3)\n\nqueue.subscribe(console.log)\n// Output: 1\n// Output: 2\n// Output: 3\n```\n\n### DelayQueue\n\n`DelayQueue` passes all the items and add delays between items.\n\n![DelayQueue](https://huan.github.io/rx-queue/images/delay.png)\n\u003e Picture Credit: [ReactiveX Single Operator Delay](http://reactivex.io/documentation/single.html)\n\nPractical examples of `DelayQueue`:\n\n1. We are calling a HTTP API which can only be called no more than ten times per second, or it will throw a `500` error.\n\n**Example:**\n\n```ts\nimport { DelayQueue } from 'rx-queue'\n\nconst delay = new DelayQueue(500)  // set delay period time to 500 milliseconds\ndelay.subscribe(console.log)\n\ndelay.next(1)\ndelay.next(2)\ndelay.next(3)\n\n// Output: 1\n// Paused 500 millisecond...\n// Output: 2\n// Paused 500 millisecond...\n// Output: 3\n```\n\n### ThrottleQueue\n\n`ThrottleQueue` passes one item and then drop all the following items in a period of time.\n\n![ThrottleQueue](https://huan.github.io/rx-queue/images/throttle.png)\n\u003e Picture Credit: [ReactiveX Observable Throttle](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-throttle)\n\nBy using throttle, we don't allow to our queue to pass more than once every X milliseconds.\n\nPractical examples of `ThrottleQueue`:\n\n1. User is typing text in a textarea. We want to call auto-save function when user is typing, and want it only run at most once every five minutes.\n\n**Example:**\n\n```ts\nimport { ThrottleQueue } from 'rx-queue'\n\nconst throttle = new ThrottleQueue(500)  // set period time to 500 milliseconds\nthrottle.subscribe(console.log)\n\nthrottle.next(1)\nthrottle.next(2)\nthrottle.next(3)\n\n// Output: 1\n```\n\n### DebounceQueue\n\n`DebounceQueue` drops a item if there's another one comes in a period of time.\n\n![DebounceQueue](https://huan.github.io/rx-queue/images/debounce.png)\n\u003e Picture Credit: [ReactiveX Observable Debounce](http://reactivex.io/documentation/operators/debounce.html)\n\nThe Debounce technique allow us to deal with multiple sequential items in a time period to only keep the last one.\n\nDebouncing enforces that no more items will be passed again until a certain amount of time has passed without any new items coming.\n\nPractical examples of `DebounceQueue`:\n\n1. User is typing text in a search box. We want to make an auto-complete function call only after the user stop typing for 500 milliseconds.\n\n**Example:**\n\n```ts\nimport { DebounceQueue } from 'rx-queue'\n\nconst debounce = new DebounceQueue(500)  // set period time to 500 milliseconds\ndebounce.subscribe(console.log)\n\ndebounce.next(1)\ndebounce.next(2)\ndebounce.next(3)\n\n// Paused 500 millisecond...\n// Output: 3\n```\n\n### DelayQueueExecutor\n\n`DelayQueueExecutor` calls functions one by one with a delay time period between calls.\n\n\u003e If you want this feature but do not want rxjs dependencies, you can have a look on a zero dependencies alternative: [BottleNeck](https://github.com/SGrondin/bottleneck）\n\n![DelayQueueExecutor](https://huan.github.io/rx-queue/images/delay.png)\n\u003e Picture Credit: [ReactiveX Single Operator Delay](http://reactivex.io/documentation/single.html)\n\nPractical examples of `DelayQueueExecutor`:\n\n1. We are calling a HTTP API which can only be called no more than ten times per second, or it will throw a `500` error.\n\n**Example:**\n\n```ts\nimport { DelayQueueExecutor } from 'rx-queue'\n\nconst delay = new DelayQueueExecutor(500)  // set delay period time to 500 milliseconds\n\ndelay.execute(() =\u003e console.log(1))\ndelay.execute(() =\u003e console.log(2))\ndelay.execute(() =\u003e console.log(3))\n\n// Output: 1\n// Paused 500 millisecond...\n// Output: 2\n// Paused 500 millisecond...\n// Output: 3\n```\n\n### `concurrencyExecuter()`\n\nWhen we have a array and need to use an async function to get the result of them, we can use `Promise.all()`:\n\n```ts\nconst asyncTask = async function (item) {\n  /**\n   * Some heavy task, like:\n   *  1. requires XXX MB of memory\n   *  2. make 10+ new network connections and each takes 10+ seconds\n   *  3. etc.\n   */\n}\n\nconst result = await Promise.all(\n  hugeArray.map(item =\u003e asyncTask),\n)\n```\n\nBecause the above example `asyncTask` requires lots of resource for each task,\nso if the `hugeArray` has many items, like 1,000+,\nthen to use the `Promise.all` will very likely to crash the system.\n\nThe solution is that we can use `concurrencyExecuter()` to execute them in parallel with a concurrency limitation.\n\n```ts\n// async task:\nconst heavyTask = (n: number) =\u003e Promise.resolve(resolve =\u003e setTimeout(resolve(n^2), 100))\n\nconst results = concurrencyExecuter(\n  2,          // concurrency\n)(\n  heavyTask,  // task async function\n)(\n  [1, 2, 3],  // task arguments\n)\n\n/**\n * in the following `for` loop, we will have 2 currency tasks running at the same time.\n */\nfor await (const result of results) {\n  console.log(result)\n}\n```\n\nThat's it.\n\n## SEE ALSO\n\n* [Writing Marble Tests](https://github.com/ReactiveX/rxjs/blob/master/doc/writing-marble-tests.md)\n\n## CHANGELOG\n\n### main v1.0 (Nov 23, 2021)\n\n1. ES Module Support\n1. TypeScript 4.5\n1. `concurrencyExecuter()` method added\n\n### v0.12 - May 2021\n\n1. Upgrade RxJS to v7.1\n1. Upgrade TypeScript to v4.3\n1. Fix RxJS breaking changes [#71](https://github.com/huan/rx-queue/issues/71)\n\n### v0.8 - Mar 2019\n\n1. Fix typo: issue [#40](https://github.com/huan/rx-queue/issues/40) - rename `DelayQueueExector` to `DelayQueueExecutor`\n\n### v0.6 - Sep 2018\n\n1. fix exception bug in browser(ie. Angular)\n\n### v0.4 - May 2018\n\n1. Upgrade to RxJS 6\n1. Moved CI from Travis-ci.org  to Travis-ci.com\n\n### v0.2 - Oct 30, 2017\n\n1. Support: `DelayQueue`, `ThrottleQueue`, `DebounceQueue`, `DelayQueueExecutor`.\n1. first version\n\n## AUTHOR\n\n[Huan LI (李卓桓)](http://linkedin.com/in/zixia) \\\u003czixia@zixia.net\\\u003e\n\n[![Profile of Huan LI (李卓桓) on StackOverflow](https://stackexchange.com/users/flair/265499.png)](https://stackexchange.com/users/265499)\n\n## COPYRIGHT \u0026 LICENSE\n\n* Code \u0026 Docs © 2017-now Huan LI \\\u003czixia@zixia.net\\\u003e\n* Code released under the Apache-2.0 License\n* Docs released under Creative Commons\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuan%2Frx-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuan%2Frx-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuan%2Frx-queue/lists"}