{"id":30180566,"url":"https://github.com/ubolonton/js-csp","last_synced_at":"2026-01-09T23:03:14.431Z","repository":{"id":13654165,"uuid":"16347676","full_name":"js-csp/js-csp","owner":"js-csp","description":"CSP channels for Javascript (like Clojurescript's core.async, or Go)","archived":false,"fork":false,"pushed_at":"2022-07-20T03:14:27.000Z","size":707,"stargazers_count":2329,"open_issues_count":36,"forks_count":121,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-08-05T06:19:35.271Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/js-csp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-29T14:49:13.000Z","updated_at":"2025-07-23T21:22:15.000Z","dependencies_parsed_at":"2022-08-28T15:50:22.398Z","dependency_job_id":null,"html_url":"https://github.com/js-csp/js-csp","commit_stats":null,"previous_names":["ubolonton/js-csp"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/js-csp/js-csp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-csp%2Fjs-csp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-csp%2Fjs-csp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-csp%2Fjs-csp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-csp%2Fjs-csp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/js-csp","download_url":"https://codeload.github.com/js-csp/js-csp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-csp%2Fjs-csp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270024697,"owners_count":24514054,"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-08-12T02:00:09.011Z","response_time":80,"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":[],"created_at":"2025-08-12T08:01:18.386Z","updated_at":"2026-01-09T23:03:14.392Z","avatar_url":"https://github.com/js-csp.png","language":"JavaScript","funding_links":[],"categories":["Repository","Packages","JavaScript","包","Control flow","目录","Libraries"],"sub_categories":["Control flow","流程控制","[Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)"],"readme":"[![Build Status](https://travis-ci.org/ubolonton/js-csp.svg?branch=master)](https://travis-ci.org/ubolonton/js-csp)\n[![codecov](https://codecov.io/gh/ubolonton/js-csp/branch/master/graph/badge.svg)](https://codecov.io/gh/ubolonton/js-csp)\n[![Dependency Status](https://david-dm.org/ubolonton/js-csp.svg)](https://david-dm.org/ubolonton/js-csp)\n[![devDependency Status](https://david-dm.org/ubolonton/js-csp/dev-status.svg)](https://david-dm.org/ubolonton/js-csp#info=devDependencies)\n\n# js-csp\nCommunicating sequential processes for Javascript (like Clojurescript core.async, or Go).\n\n## Maintainer wanted\nThis project is at maintenance mode at the moment, and actively looking for new maintainers. Please send us\nan issue via github if you are interested.\n\nCurrent maintainer: [hung-phan](https://github.com/hung-phan), [gt3](https://github.com/gt3)\n\n## Examples\n```javascript\nconst csp = require('js-csp');\n```\n\nPingpong (ported from [Go](http://talks.golang.org/2013/advconc.slide#6)).\n\n```javascript\nfunction* player(name, table) {\n  while (true) {\n    let ball = yield csp.take(table);\n\n    if (ball === csp.CLOSED) {\n      console.log(name + \": table's gone\");\n      return;\n    }\n\n    ball.hits += 1;\n    console.log(`${name} ${ball.hits}`);\n\n    yield csp.timeout(100);\n    yield csp.put(table, ball);\n  }\n}\n\ncsp.go(function* () {\n  const table = csp.chan();\n\n  csp.go(player, [\"ping\", table]);\n  csp.go(player, [\"pong\", table]);\n\n  yield csp.put(table, {hits: 0});\n  yield csp.timeout(1000);\n\n  table.close();\n});\n```\n\nThere are more under [examples](examples/) directory.\n\n## Documentation\n\n- [Basic concepts and API](doc/basic.md).\n- [Advanced operations](doc/advanced.md).\n\nThis is a very close port of Clojurescript's [core.async](https://github.com/clojure/core.async). The most significant difference\nis that the IOC logic is encapsulated using generators (`yield`) instead of macros. Therefore resources on `core.async` or Go channels are also helpful.\n\n## Other\n\nOr, if you use Python's Twisted:\nhttps://github.com/ubolonton/twisted-csp\n\nOr, if you use Clojure:\nhttps://github.com/clojure/core.async\n\n## Install\n\n```bash\nnpm install js-csp\n```\n\n```bash\nbower install js-csp\n```\n\n## Contribution\n\nFeel free to open issues for questions/discussions, or create pull requests for improvement.\n\nSome areas that need attention:\n- More documentation, examples, and maybe some visualization. Porting RxJS/Bacon examples may help.\n- Multiplexing, mixing, publishing/subscribing. These need to be tested more. The API could also be improved.\n- Deadlock detection.\n\n### Development\n\nThese commands are supposed to run separately\n```bash\n$ npm run test:watch\n$ npm run lint # for code quality checking\n$ npm run flow:watch # to stop server after you are done run npm run flow:stop\n```\n\n### Production\n\n```bash\n$ npm run build\n```\n\nIt will transpile all the codes in `src` to `lib`, or even better if you use `webpack 2` to consume\nthe lib via `\"module\": \"./src/csp.js\"`.\n\n## Inspiration\n\n- http://swannodette.github.io/2013/08/24/es6-generators-and-csp\n- https://github.com/clojure/core.async\n- https://github.com/olahol/node-csp\n\n## License\n\nDistributed under [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubolonton%2Fjs-csp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fubolonton%2Fjs-csp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubolonton%2Fjs-csp/lists"}