{"id":13415010,"url":"https://github.com/zebulonj/callbag-subscribe","last_synced_at":"2025-02-27T14:57:15.714Z","repository":{"id":54809608,"uuid":"120513966","full_name":"zebulonj/callbag-subscribe","owner":"zebulonj","description":"A callbag sink (listener) that connects an Observer a-la RxJS. 👜","archived":false,"fork":false,"pushed_at":"2021-01-28T01:24:10.000Z","size":23,"stargazers_count":18,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T17:20:46.013Z","etag":null,"topics":["callbag","observables","reactive","rx"],"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/zebulonj.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}},"created_at":"2018-02-06T19:40:41.000Z","updated_at":"2023-01-15T07:02:01.000Z","dependencies_parsed_at":"2022-08-14T03:31:09.698Z","dependency_job_id":null,"html_url":"https://github.com/zebulonj/callbag-subscribe","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebulonj%2Fcallbag-subscribe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebulonj%2Fcallbag-subscribe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebulonj%2Fcallbag-subscribe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebulonj%2Fcallbag-subscribe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zebulonj","download_url":"https://codeload.github.com/zebulonj/callbag-subscribe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241026947,"owners_count":19896718,"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":["callbag","observables","reactive","rx"],"created_at":"2024-07-30T21:00:41.452Z","updated_at":"2025-02-27T14:57:15.677Z","avatar_url":"https://github.com/zebulonj.png","language":"JavaScript","funding_links":[],"categories":["Table Contents"],"sub_categories":["Sink factories"],"readme":"# callbag-subscribe 👜\n\n[![CircleCI](https://img.shields.io/circleci/project/zebulonj/callbag-subscribe.svg)]() [![npm](https://img.shields.io/npm/v/callbag-subscribe.svg)]() [![npm](https://img.shields.io/npm/dt/callbag-subscribe.svg)]()\n\nA callbag sink (listener) that connects an Observer a-la RxJS.\n\n`npm install callbag-subscribe`\n\n## Usage:\n\n### Simple (next only)\n\n```js\nimport pipe from 'callbag-pipe';\nimport interval from 'callbag-interval';\nimport subscribe from 'callbag-subscribe';\n\nconst source = interval( 10 );\n\npipe(\n  source,\n  subscribe( val =\u003e console.log( val ) )\n);\n\n// 0\n// 1\n// 2\n// 3\n// 4\n// 5\n// 6\n// 7\n// 8\n// 9\n```\n\n### Complete observer\n\n```js\nimport pipe from 'callbag-pipe';\nimport interval from 'callbag-interval';\nimport subscribe from 'callbag-subscribe';\n\nconst source = interval( 10 );\n\npipe(\n  source,\n  subscribe({\n    next: val =\u003e console.log( val ),\n    complete: () =\u003e console.log( 'Done!' ),\n    error: err =\u003e console.error( err )\n  })\n);\n\n// 0\n// 1\n// 2\n// 3\n// 4\n// 5\n// 6\n// 7\n// 8\n// 9\n// Done!\n```\n\n### Disposal\n\nUse the returned disposal function to terminate the subscription.\n\n```js\nconst source = fromEvent( document.body, 'click' );\n\nconst dispose = pipe(\n  source,\n  subscribe({\n    next: ev =\u003e console.log( 'Click:', ev )\n  })\n);\n\n// Do some stuff...\n\ndispose(); // Terminate the subscription.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebulonj%2Fcallbag-subscribe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzebulonj%2Fcallbag-subscribe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebulonj%2Fcallbag-subscribe/lists"}