{"id":18394417,"url":"https://github.com/romac/jo","last_synced_at":"2025-07-28T00:10:09.600Z","repository":{"id":14241226,"uuid":"16948520","full_name":"romac/jo","owner":"romac","description":"🚧  Clojure's core.async channels in JavaScript (ABANDONED)","archived":false,"fork":false,"pushed_at":"2014-09-04T16:33:48.000Z","size":326,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T14:29:33.546Z","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/romac.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}},"created_at":"2014-02-18T12:42:29.000Z","updated_at":"2016-11-02T15:25:02.000Z","dependencies_parsed_at":"2022-09-22T08:31:23.787Z","dependency_job_id":null,"html_url":"https://github.com/romac/jo","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/romac/jo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Fjo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Fjo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Fjo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Fjo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romac","download_url":"https://codeload.github.com/romac/jo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romac%2Fjo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267442483,"owners_count":24087807,"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-07-27T02:00:11.917Z","response_time":82,"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":"2024-11-06T02:05:41.610Z","updated_at":"2025-07-28T00:10:09.531Z","avatar_url":"https://github.com/romac.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Jo\n\n\u003e A port to JavaScript of ClojureScript's core.async channels.\n\n### Notice\n\nThis library is experimental and I do not currently plan to publish it to npm. Please use another implementation of CSP channels, such as [js-csp](https://github.com/ubolonton/js-csp) or [task.js](http://taskjs.org/).\n\n### Usage\n\n```js\nvar jo = require('jo')\n\nvar c = jo.chan(1);\n\njo.go(function*() {\n  var i = 0;\n  while (true) {\n    i = yield jo.take(c);\n    console.log('ping got \"%s\".', i);\n    yield jo.put(c, i + 1);\n  }\n});\n\njo.go(function*() {\n  var i = 0;\n  while (true) {\n    i = yield jo.take(c);\n    console.log('pong got \"%s\".', i);\n    yield jo.put(c, i + 1);\n  }\n});\n\n// asynchronously put a value into the channel\nc.put(1);\n```\n\nNote: We must use `Channel#put(value)` in the last line because we are not inside a `go` block. This operation is thus executed asynchronously.\n\n### API\n\n#### `chan(size) :: Int -\u003e Channel`\nCreates a buffered channel with a buffer of size `size`.\n\n#### `chan(buffer) :: Buffer -\u003e Channel`\nCreates a channel with the supplied buffer.\nSee [jo-buffers](romac/jo-buffers) for an overview of the available buffers.\n\n#### `chan() :: Unit -\u003e Channel`\nCreates an unbuffered channel.\n\n#### `go(gen*) :: Function* -\u003e Channel`\nSpawn the given generator, and returns a channel that receives the value returned by the coroutine.\n\n#### `yield take(chan) :: Channel -\u003e Unit`\nBlocks until a value is available on the given channel, and returns it.\n\n#### `yield put(chan) :: Channel -\u003e Unit`\nPuts a value on the given channel. If the channel is buffered, this will block until the channel accepts the value.\n\n#### `yield wait(ms) :: Int -\u003e Unit`\nBlock for `ms` milliseconds.\n\n#### `yield await(fn, ...args) :: Function -\u003e Any... -\u003e [Error, Any]`\nCall `fn` with the supplied arguments `args`, and returns an array holding the error (if any) and an array of values passed by `fn` to the internal callback.\n\n#### `timeout(ms) :: Int -\u003e Channel`\nCreates a channel that will close after `ms` milliseconds.\n\n### Macros\nA few [sweet.js](http://sweetjs.org/) macros are bundled with jo. You can find a README, and some examples in the `macros/` folder.\n\n### Copyright and license\n\nCopyright © 2014 Romain Ruetschi\n\nLicensed under the Eclipse Public License (see the file epl.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromac%2Fjo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromac%2Fjo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromac%2Fjo/lists"}