{"id":22505187,"url":"https://github.com/azer/pubsub","last_synced_at":"2025-06-25T03:34:34.206Z","repository":{"id":6087217,"uuid":"7313977","full_name":"azer/pubsub","owner":"azer","description":"Minimalistic Pubsub Implementation","archived":false,"fork":false,"pushed_at":"2014-05-18T05:15:49.000Z","size":248,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-02T08:16:51.035Z","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/azer.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":"2012-12-25T04:18:37.000Z","updated_at":"2019-11-19T18:54:16.000Z","dependencies_parsed_at":"2022-09-26T17:00:59.969Z","dependency_job_id":null,"html_url":"https://github.com/azer/pubsub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/azer/pubsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fpubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fpubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fpubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fpubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azer","download_url":"https://codeload.github.com/azer/pubsub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fpubsub/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261799148,"owners_count":23211341,"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":[],"created_at":"2024-12-07T00:15:41.600Z","updated_at":"2025-06-25T03:34:34.179Z","avatar_url":"https://github.com/azer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pubsub [![Build Status](https://travis-ci.org/azer/pubsub.png)](https://travis-ci.org/azer/pubsub)\n\nLibrary for creating individual events with a minimalistic API.\n\n## Install\n\n```bash\n$ npm install pubsub\n```\n\n## Usage\n\n```js\nonReady = pubsub()\n\nonReady(function(a, b, c){ // shortcut to: onReady.subscribe\n    console.log(a, b, c)\n    // =\u003e 3, 4, 1\n})\n\nonReady.publish(3, 4, 1)\n```\n\nYou can optionally, you can pass `pubsub()` an object to mix the interfaces:\n\n```js\nfoo = pubsub({ value: 12345 })\n\nfoo.subscribe(function () {\n\n  foo.value\n  // =\u003e 3.14\n  // =\u003e 158\n})\n\nfoo.value = 314\nfoo.publish()\n\nfoo.value = 158\nfoo.publish()\n```\n\n## API\n\n### subscribe(`fn`)\n\n```js\nfoo.subscribe(function(update){\n\n    update\n    // =\u003e 3.14\n    // =\u003e 156\n    // =\u003e { last: true }\n\n})\n\nfoo.publish(3.14)\nfoo.publish(156)\nfoo.publish({ last: true })\n```\n\n### subscribe.once(`fn`)\n\n```js\nfoo.subscribe.once(function(update){\n\n    update\n    // =\u003e 3.14\n\n})\n\nfoo.publish(3.14)\nfoo.publish(156)\n\n```\n\n### unsubscribe(`fn`)\n\n### unsubscribe.once(`fn`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fpubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazer%2Fpubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fpubsub/lists"}