{"id":15389499,"url":"https://github.com/jgarber623/radioradio","last_synced_at":"2025-10-22T21:22:54.825Z","repository":{"id":5420980,"uuid":"53104472","full_name":"jgarber623/RadioRadio","owner":"jgarber623","description":"A very small JavaScript PubSub library.","archived":false,"fork":false,"pushed_at":"2025-01-03T01:32:39.000Z","size":574,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-23T01:05:47.896Z","etag":null,"topics":["javascript","pubsub"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@jgarber/radioradio","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/jgarber623.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-04T03:25:44.000Z","updated_at":"2025-01-03T01:32:23.000Z","dependencies_parsed_at":"2024-05-02T04:29:55.369Z","dependency_job_id":"8c000810-6520-4d95-9f42-ddebcbc96d15","html_url":"https://github.com/jgarber623/RadioRadio","commit_stats":{"total_commits":205,"total_committers":2,"mean_commits":102.5,"dds":"0.41463414634146345","last_synced_commit":"cada8496121e53fe0553c314f18c2198c8f028b2"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgarber623%2FRadioRadio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgarber623%2FRadioRadio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgarber623%2FRadioRadio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgarber623%2FRadioRadio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgarber623","download_url":"https://codeload.github.com/jgarber623/RadioRadio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240339576,"owners_count":19785956,"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":["javascript","pubsub"],"created_at":"2024-10-01T15:01:53.738Z","updated_at":"2025-10-22T21:22:54.820Z","avatar_url":"https://github.com/jgarber623.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]\n\u003e This project has moved to [codeberg.org/jgarber/RadioRadio](https://codeberg.org/jgarber/RadioRadio).\n\n# RadioRadio\n\n**A very small, lightweight, dependency-free JavaScript [PubSub](https://en.wikipedia.org/wiki/Publish–subscribe_pattern) library.**\n\n[![npm](https://img.shields.io/npm/v/@jgarber/radioradio.svg?logo=npm\u0026style=for-the-badge)](https://www.npmjs.com/package/@jgarber/radioradio)\n[![Downloads](https://img.shields.io/npm/dt/@jgarber/radioradio.svg?logo=npm\u0026style=for-the-badge)](https://www.npmjs.com/package/@jgarber/radioradio)\n[![Build](https://img.shields.io/github/actions/workflow/status/jgarber623/RadioRadio/ci.yml?branch=main\u0026logo=github\u0026style=for-the-badge)](https://github.com/jgarber623/RadioRadio/actions/workflows/ci.yml)\n\n\u003e [!NOTE]\n\u003e RadioRadio is feature complete and will only be updated to address bugs or security issues.\n\n### Key Features\n\n- Supports namespaced events (e.g. `foo.bar`)\n- Dependency-free\n- JavaScript module (ESM)\n\n## Getting RadioRadio\n\nYou've got a couple options for adding RadioRadio to your project:\n\n- [Download a release](https://github.com/jgarber623/RadioRadio/releases) from GitHub and do it yourself _(old school)_.\n- Install using [npm](https://www.npmjs.com/package/@jgarber/radioradio): `npm install @jgarber/radioradio --save`\n- Install using [Yarn](https://yarnpkg.com/en/package/@jgarber/radioradio): `yarn add @jgarber/radioradio`\n\n## Usage\n\n### Subscribing\n\n```js\nRadioRadio.subscribe(topic, subscriber);\n```\n\n- **Accepts:** `topic` (String) and `subscriber` (Function)\n- **Returns:** String or `false`\n\n#### The `topic` argument\n\nTopics must be strings of any length (e.g. `foo`) made up of letters, numbers, and underscores. Topics may also be organized into namespaces using a `.` as a separator (e.g. `foo.bar`).\n\nTopics within a namespace may themselves act as namespaces. For example, a subscribed topic `foo.bar.biz` exists in the `foo` _and_ `foo.bar` namespaces. Note that this structure will affect publication (see [Publishing](#publishing) below).\n\nWildcard topics within a namespace (e.g. `foo.*`, `foo.bar.*`) are also allowed. See [Publishing](#publishing) below for more on when these topics are published.\n\n#### The `subscriber` argument\n\nA function to execute when `topic` is published. Subscribers accept a single argument (`data`) passed on from the `publish` method.\n\n### Publishing\n\n```js\nRadioRadio.publish(topic, data);\n```\n\n- **Accepts:** `topic` (String) and `data` (Object)\n- **Returns:** Array or `false`\n\n#### The `topic` argument\n\nThe topic to which you wish to publish. When using namespaced topics (e.g. `foo.bar`), you may publish to a single topic:\n\n```js\nRadioRadio.publish(\"foo.bar\", data);\n```\n\n…or, to a topic and any topics within its namespace:\n\n```js\nRadioRadio.publish(\"foo\", data);\n```\n\nPublishing to the namespace `foo` will publish to `foo` and _all_ topics namespaced to `foo` (e.g. `foo.bar`, `foo.biz`, `foo.baz`). As mentioned above in [Subscribing](#subscribing), topics may be deeply nested (e.g. `foo.bar.biz`) which will affect publishing to namespaces:\n\n```js\nRadioRadio.publish(\"foo\", data);     // publishes to `foo`, `foo.bar`, `foo.bar.biz`\nRadioRadio.publish(\"foo.bar\", data); // publishes to `foo.bar`, `foo.bar.biz`\n```\n\nWildcard topics within a namespace (e.g. `foo.*`) will be published alongside adjacent (e.g. `foo.bar`, `foo.biz`) published topics:\n\n```js\nRadioRadio.subscribe(\"foo.bar\", subscriber);\nRadioRadio.subscribe(\"foo.*\", wildcardSubscriber);\n\nRadioRadio.publish(\"foo.bar\", data); // publishes to `foo.bar` and `foo.*`\n```\n\nNote that topics are published in the order in which they were originally subscribed.\n\n#### The `data` argument\n\nThe data to pass along to subscribers. Most usefully an Object, `data` _could_ be anything so long as the topic's subscriber functions are prepared to handle it.\n\n### Unsubscribing\n\n```js\nRadioRadio.unsubscribe(topic);\n```\n\n- **Accepts:** `topic` (String)\n- **Returns:** `true`\n\n#### The `topic` argument\n\nThe topic from which you wish to unsubscribe. Calling this method removes `topic` from the stored list of subscribed topics. Subsequent calls to publish to that topic will fail silently, returning `false`.\n\n### Example\n\nFor a full-featured RadioRadio demonstration, check out [the demo page](https://jgarber623.github.io/RadioRadio/example/) and [the example file](https://github.com/jgarber623/RadioRadio/blob/main/example/index.html).\n\n## Browser Support\n\n**RadioRadio works in modern browsers.** The library makes use of several new(ish) JavaScript methods and, in an effort to remain as lightweight and dependency-free as possible, leaves it up to you to choose whether or not to polyfill features for older browsers.\n\n## Acknowledgments\n\nRadioRadio is inspired by [Morgan Roderick](https://github.com/mroderick)'s [PubSubJS](https://github.com/mroderick/PubSubJS).\n\nRadioRadio is written and maintained by [Jason Garber](https://sixtwothree.org) and, yes, it's named after [an Elvis Costello \u0026 The Attractions song](https://www.youtube.com/watch?v=eifljYPFW-E). It's also another in a growing line of small, curiously-named JavaScript utilities:\n\n- [CashCash](https://github.com/jgarber623/CashCash), a very small DOM library inspired by [jQuery](https://jquery.com).\n- [RouterRouter](https://github.com/jgarber623/RouterRouter), a very small routing library extracted from [Backbone's Router](http://backbonejs.org/docs/backbone.html#section-185).\n- [TemplateTemplate](https://github.com/jgarber623/TemplateTemplate), a very small `\u003ctemplate\u003e` manipulation library.\n\n## License\n\nRadioRadio is freely available under [The MIT License](https://opensource.org/licenses/MIT). Use it, learn from it, fork it, improve it, change it, tailor it to your needs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgarber623%2Fradioradio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgarber623%2Fradioradio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgarber623%2Fradioradio/lists"}