{"id":44631621,"url":"https://github.com/bluet/callbaq","last_synced_at":"2026-02-14T16:35:10.017Z","repository":{"id":57193159,"uuid":"132986448","full_name":"bluet/callbaq","owner":"bluet","description":"Convert nested callback hell into serial procedural coding style, which is more readable, writable, and maintainable.","archived":false,"fork":false,"pushed_at":"2025-11-28T05:04:06.000Z","size":273,"stargazers_count":11,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-28T17:12:15.818Z","etag":null,"topics":["async","callback","callback-functions","callback-queue","fossa-status","hacktoberfest","procedural","promise","queue","workflow"],"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/bluet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"bluet","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2018-05-11T03:50:58.000Z","updated_at":"2025-11-25T11:23:43.000Z","dependencies_parsed_at":"2024-11-30T20:28:52.979Z","dependency_job_id":"6b203a51-e15a-451d-a8ff-103d7853ba15","html_url":"https://github.com/bluet/callbaq","commit_stats":{"total_commits":40,"total_committers":4,"mean_commits":10.0,"dds":"0.44999999999999996","last_synced_commit":"87d6b983263eb13c354d7c5f2a3e4f506bb0d402"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bluet/callbaq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluet%2Fcallbaq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluet%2Fcallbaq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluet%2Fcallbaq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluet%2Fcallbaq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluet","download_url":"https://codeload.github.com/bluet/callbaq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluet%2Fcallbaq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29449374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["async","callback","callback-functions","callback-queue","fossa-status","hacktoberfest","procedural","promise","queue","workflow"],"created_at":"2026-02-14T16:35:07.657Z","updated_at":"2026-02-14T16:35:10.009Z","avatar_url":"https://github.com/bluet.png","language":"JavaScript","readme":"# Callbaq\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbluet%2Fcallbaq.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbluet%2Fcallbaq?ref=badge_shield)\n\n\n## NAME\n\n**Callbaq** - A callback queue for workflow control.\n\nLightweight, **Zero Dependency.**\n\n## SYNOPSIS\n\n```javascript\nvar Callbaq = require('callbaq');\nvar workflow = new Callbaq();\n\n// kickoff\nworkflow.start(\"new world!\");\n\n// add callback functions\nworkflow.add(function (cbq, input) {\n        console.log(\"1: hello world : \" + input);\n        cbq.next(\"y0y0\");\n});\nworkflow.add(function (cbq, input) { console.log(\"2: here we go : \" + input); });\n\n// output:\n// 1: hello world : new world!\n// 2: here we go : y0y0\n```\n\nOr fire it later, also try using aliases methods\n\n```javascript\n// add callback functions\nworkflow.add(function (cbq, input) {\n        console.log(\"1: hello world : \" + input);\n        cbq.resolve(\"y0y0\");\n});\nworkflow.then(function (cbq, input) {\n        console.log(\"2: here we go : \" + input);\n        return \"knock knock\";\n});\n// fire\nvar door = workflow.start(\"new world!\");\n\n// output:\n// 1: hello world : new world!\n// 2: here we go : y0y0\n// content of door: \"knock knock\"\n```\n\n## DESCRIPTION\n\n**callbaq** is a lightweight callback queue for workflow and callback control with **Zero Dependency**.  \nConvert nested callback hell into serial procedural coding style, which is more readable, writable, and maintainable.\n\nWork standalone, or with other modules.\n\n## INSTALLATION\n\n`npm i callbaq`\n\n## METHODS\n\n### **new**\n\nGet a new callback queue / flow.\n\n```javascript\nvar Callbaq = require('callbaq');\nvar callbaq = new Callbaq();\n```\n\n### **start**\n\nStart and walk through the workflow from step 0.\n\n```javascript\ncallbaq.start(\"new world!\");\n```\n\n### **add / then**\n\nAdd (append) a function for use as a callback, which will be executed at the next step.\n\nThe parameters for callback are:\n1. `callbaq` instance of the current callback queue.\n2. params from `start()` or the output of previous (step) callback function.\n\n```javascript\ncallbaq.add(function (cbq, input) {\n        console.log(\"something cool : \" + input);\n        cbq.next(\"a secret\");\n});\ncallbaq.then(function (cbq, input) {\n        console.log(\"finished with \" + input);\n});\n```\n\n\n### **next / resolve**\n\nCheck out from the current step and pass result to next step / callback function when works are done.\n\n```javascript\ncallbaq.add(function (cbq, input) {\n        cbq.resolve(\"A master piece\");\n});\ncallbaq.then(function (cbq, input) {\n        cbq.next(\"A master piece\");\n})\n```\n\n## EXPERIMENTAL use of Methods\n\nThe following methods are for EXPERIMENTAL usage and might change in the future.\n\nAvoid using them if possible.\n\n### cbq\n\nSimilar to add(). Returns the queue array.  \nIf called with a function object, the function object will be append into queue.\n\n```javascript\nvar old_queue = callbaq.cbq();\nvar new_queue = callbaq.cbq(function(cbq){ cbq.next(\"did something\") });\n```\n\n### current_step\n\nGet or set current step number.  \nWorkflow could be changed by calling this method with value.\n\n```javascript\nvar current_step_number = cbq.current_step();\n\n// start over from the first step\nvar new_step_number = cbq.current_step(0);\ncbq.next(\"some params\");\n```\n\n### step\n\nCall specific step.\n\n```javascript\ncallbaq.step(3, \"some params\");\n```\n\n\n## ATTRIBUTES\n\nThe following methods are for EXPERIMENTAL usage and for Expert Only, might change in the future.\n\nAvoid accessing them directly if possible.\n\n### dataqueue\n\nThe queue of data awaiting for being input of callback functions, `Array` of `any`.\n\n### _cbq\n\nThe callback queue, `Array` of `function`.\n\n### _current_step\n\nCurrent step, in `number`.\n\n### Create with custom initial values\n\n```javascript\nvar dataqueue = [1, 2];\n\n// new with default values\nvar callbaq = new Callbaq({dataqueue: dataqueue});\ncallbaq.add(function (cbq, input) {\n        console.log(\"something in data queue: \", input);\n});\n// will be executed immediately without needing callbaq.start()\n```\n\n## EXAMPLES\n\nYou can have multiple callbaq instances working together or independently.\n\nJust new some and enjoy them.\n\n\u003chttps://github.com/BlueT/callbaq/blob/master/example.js\u003e\n\n```\nOutput:\n\tcb1, step 1: hello world :  [ 'new world!' ]\nv-\u003e\tcb1, step 2: here we go :  [ 'y0y0' ]\n|\t----------\n|\tcb2, step 1: Are you ok : bro\n|\t---\u003e inner1: asking bro\n|\t---\u003e inner2: he's fine\n|\tcb2, step 2: I am very ok : Let's rock N roll\n|\t----------\n^-\u003e\tcb1, step 3: here we go :  [ 'hEy Lo' ]\n\t----------\n\tsomething in data queue:  1\n\tand guess what!  [ 'lala' ]\n\tfrom dataqueue again!  2\n```\n\n## AUTHOR\n\nBlueT - Matthew Lien - 練喆明 \u003cBlueT@BlueT.org\u003e\n\n## CREDITS\n\nWaiting for **Your Name** here.\n\n## BUGS\n\nhttps://github.com/BlueT/callbaq/issues\n\n## CONTRIBUTE\n\nYou can do a [Fork](https://github.com/BlueT/callbaq#fork-destination-box), fix bug or improve code, and send a PR.  \nOr you can [file a issue](https://github.com/BlueT/callbaq/issues) for bugs or improvements.\n\nIf you find this module useful, please give me a **Star**, I'll be happy whole day.\n\nHope this module can save your time, a tree, and a kitten.\n\n## SEE ALSO\n\nAnyEvent::CallbackStack - Perl version https://github.com/BlueT/AnyEvent-CallbackStack\n\n## License\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbluet%2Fcallbaq.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbluet%2Fcallbaq?ref=badge_large)","funding_links":["https://ko-fi.com/bluet"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluet%2Fcallbaq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluet%2Fcallbaq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluet%2Fcallbaq/lists"}