{"id":25839489,"url":"https://github.com/arnellebalane/hermes","last_synced_at":"2025-03-01T04:32:39.519Z","repository":{"id":46108409,"uuid":"90735004","full_name":"arnellebalane/hermes","owner":"arnellebalane","description":"Client-side messaging channel for sending data from one browser tab to another","archived":false,"fork":false,"pushed_at":"2021-11-14T08:00:53.000Z","size":104,"stargazers_count":129,"open_issues_count":2,"forks_count":29,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-14T07:46:14.265Z","etag":null,"topics":["broadcast-channel","client-side","hacktoberfest","localstorage","npm-package","shared-worker"],"latest_commit_sha":null,"homepage":"https://hermes.arnelle.dev","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/arnellebalane.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":"2017-05-09T10:48:52.000Z","updated_at":"2024-04-14T07:46:14.266Z","dependencies_parsed_at":"2022-09-10T22:52:09.529Z","dependency_job_id":null,"html_url":"https://github.com/arnellebalane/hermes","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnellebalane%2Fhermes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnellebalane%2Fhermes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnellebalane%2Fhermes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnellebalane%2Fhermes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arnellebalane","download_url":"https://codeload.github.com/arnellebalane/hermes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241317638,"owners_count":19943199,"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":["broadcast-channel","client-side","hacktoberfest","localstorage","npm-package","shared-worker"],"created_at":"2025-03-01T04:32:39.117Z","updated_at":"2025-03-01T04:32:39.512Z","avatar_url":"https://github.com/arnellebalane.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hermes\n\nClient-side messaging channel for sending data from one browser tab to another with the same origin. Think of it as a PubSub module that can send messages across multiple browser tabs.\n\nTo see a demo of Hermes in action, open [this page](https://hermes.arnelle.me/) in multiple browser tabs.\n\n\n## Usage\n\nGet a copy of `hermes.js` or `dist/hermes.min.js` and include it in your code:\n\n```html\n\u003cscript src=\"/path/to/hermes.js\"\u003e\u003c/script\u003e\n```\n\nHermes also supports AMD, so it can also be included this way:\n\n```js\nrequire(['path/to/hermes'], function(hermes) { });\n```\n\nHermes exposes an object named `hermes` which contains the API methods.\n\n\n## API\n\n- **`send(topic, data, [includeSelf=false])`**: Send data to other browser tabs subscribed to a specified topic.\n  - `topic`: The name of the topic in which the data will be sent to.\n  - `data`: The data to be sent. This needs to be a JSON-serializable object.\n  - `includeSelf` (optional, default=false): A boolean indicating whether the data should also be sent to the current tab.\n\n  ```js\n  hermes.send('some-topic', 'hello world');\n  hermes.send('some-topic', { title: 'awesome' });\n  hermes.send('some-topic', { title: 'awesome' }, true);\n  ```\n\n- **`on(topic, callback)`**: Add a callback function for a specified topic.\n  - `topic`: The name of the topic to subscribe to.\n  - `callback`: The callback function, which accepts a single argument representing the data that was sent originally.\n\n  ```js\n  hermes.on('some-topic', function(data) { });\n  ```\n\n- **`off(topic, [callback])`**: Remove a callback function for a specified topic.\n  - `topic`: The name of the topic to unsubscribe from.\n  - `callback` (optional): The callback function to remove, or don't provide in order to remove all callback functions for the `topic` topic.\n\n  ```js\n  hermes.off('some-topic', callbackFunction);\n  hermes.off('some-topic');\n  ```\n\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnellebalane%2Fhermes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnellebalane%2Fhermes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnellebalane%2Fhermes/lists"}