{"id":18023676,"url":"https://github.com/sadanandpai/generators-in-action","last_synced_at":"2026-03-14T08:01:46.271Z","repository":{"id":108468067,"uuid":"317900459","full_name":"sadanandpai/generators-in-action","owner":"sadanandpai","description":"Working of multiple generators with the help of queue data structure where the one generator yields to trigger the next one in chain till the completion of all","archived":false,"fork":false,"pushed_at":"2021-02-15T06:41:58.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-02T00:35:51.209Z","etag":null,"topics":["generator-functions","javascript"],"latest_commit_sha":null,"homepage":"https://sadanandpai.github.io/generators-in-action/","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/sadanandpai.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}},"created_at":"2020-12-02T15:10:48.000Z","updated_at":"2023-09-15T13:28:57.000Z","dependencies_parsed_at":"2023-09-24T05:11:43.893Z","dependency_job_id":null,"html_url":"https://github.com/sadanandpai/generators-in-action","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"642fd949fd90257ec2a268e15e2a098c622e0c58"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sadanandpai/generators-in-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadanandpai%2Fgenerators-in-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadanandpai%2Fgenerators-in-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadanandpai%2Fgenerators-in-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadanandpai%2Fgenerators-in-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sadanandpai","download_url":"https://codeload.github.com/sadanandpai/generators-in-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadanandpai%2Fgenerators-in-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273672009,"owners_count":25147489,"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-04T02:00:08.968Z","response_time":61,"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":["generator-functions","javascript"],"created_at":"2024-10-30T07:10:15.360Z","updated_at":"2026-03-14T08:01:41.213Z","avatar_url":"https://github.com/sadanandpai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generators in action\n\nWorking of multiple generators with the help of queue data structure where one generator yields to trigger the next one in chain till the completion of all\n\n\u003ca href=\"https://sadanandpai.github.io/generators-in-action/\"\u003eLive Demo\u003c/a\u003e\n\n## Core logic\n```js\nasync function* gen(counter, progress) {\n    while (true) {\n        await new Promise((resolve) =\u003e setTimeout(resolve, 400));\n        if (status) {\n            yield;\n        }\n    }\n}\n\nconst iteratorQueue = [gen(), gen(), gen(), gen()];\n\nasync function startGenerators() {\n    while (iteratorQueue.length !== 0) {\n        const iterator = iteratorQueue.shift();\n        const value = await iterator.next();\n        if (!value.done) {\n            iteratorQueue.push(iterator);\n        }\n        status = false;\n    }\n}\n\n// set status = true to yield the currently running generator\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsadanandpai%2Fgenerators-in-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsadanandpai%2Fgenerators-in-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsadanandpai%2Fgenerators-in-action/lists"}