{"id":23662768,"url":"https://github.com/kezhengjie/concurrency_js","last_synced_at":"2025-12-04T14:30:14.912Z","repository":{"id":163339216,"uuid":"384371016","full_name":"kezhengjie/concurrency_js","owner":"kezhengjie","description":"a js file that implement concurrency async operation which could limit concurrency nums.","archived":false,"fork":false,"pushed_at":"2021-07-14T06:55:25.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-25T03:22:14.613Z","etag":null,"topics":["async","async-javascript","batch","concurrency","javascript","promise","thread-like"],"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/kezhengjie.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":"2021-07-09T08:22:51.000Z","updated_at":"2022-08-16T16:52:55.000Z","dependencies_parsed_at":"2023-05-18T12:11:31.178Z","dependency_job_id":null,"html_url":"https://github.com/kezhengjie/concurrency_js","commit_stats":null,"previous_names":["kezhengjie/concurrency_js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fconcurrency_js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fconcurrency_js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fconcurrency_js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fconcurrency_js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kezhengjie","download_url":"https://codeload.github.com/kezhengjie/concurrency_js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239656215,"owners_count":19675567,"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","async-javascript","batch","concurrency","javascript","promise","thread-like"],"created_at":"2024-12-29T05:07:42.431Z","updated_at":"2025-12-04T14:30:14.876Z","avatar_url":"https://github.com/kezhengjie.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# concurrency_js\na js file that implement concurrency async operation which could limit concurrency nums.\n\nusage :\n```\nC.add(asyncFuncPrototype,...args)\nC.wait().then(()=\u003e{console.log(\"all done\")})\n```\nremember to resolve() in your async function other wise queue will be blocked.\n\ndefault concurreny num is 5\n```\nC.setMaxRunning(10) to change concurrency num.\n```\n\n// look demo  for more detail.\n\n```\nfunction demo() {\n    function timeToPrint(t) {\n        return new Promise((resolve, reject) =\u003e {\n            setTimeout(() =\u003e {\n                console.log(t)\n                resolve()\n            })\n        })\n    }\n\n    setTimeout(() =\u003e {\n        for (let i = 1; i \u003c 100; i++) {\n            let t = i\n            C.add(timeToPrint, t)\n        }\n    }, 100)\n\n    setTimeout(() =\u003e {\n        for (let i = 1; i \u003c 100; i = i + 5) {\n            let t = i\n            C.add(timeToPrint, t)\n        }\n    }, 2000)\n\n    setTimeout(() =\u003e {\n        for (let i = 1; i \u003c 100; i = i + 3) {\n            let t = i\n            C.add(timeToPrint, t)\n        }\n    }, 5000)\n\n\n    C.wait().then(() =\u003e {\n        console.log(\"all done\")\n    })\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkezhengjie%2Fconcurrency_js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkezhengjie%2Fconcurrency_js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkezhengjie%2Fconcurrency_js/lists"}