
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
hermes-channel
Advanced tools
client-side messaging channel for sending data from one browser tab to another
Client-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.
To see a demo of Hermes in action, open this page in multiple browser tabs.
Get a copy of hermes.js
or dist/hermes.min.js
and include it in your code:
<script src="/path/to/hermes.js"></script>
Hermes also supports AMD, so it can also be included this way:
require(["path/to/hermes"], function (hermes) {});
Hermes exposes an object named hermes
which contains the API methods.
send(topic, data, [includeSelf=false])
: Send data to other browser tabs subscribed to a specified topic.
topic
: The name of the topic in which the data will be sent to.data
: The data to be sent. This needs to be a JSON-serializable object.includeSelf
(optional, default=false): A boolean indicating whether the data should also be sent to the current tab.hermes.send("some-topic", "hello world"); // just other tabs
hermes.send("some-topic", { title: "awesome" }, "current"); // just current tab
hermes.send("some-topic", { title: "awesome" }, "all"); // all tabs
on(topic, callback)
: Add a callback function for a specified topic.
topic
: The name of the topic to subscribe to.callback
: The callback function, which accepts a single argument representing the data that was sent originally.hermes.on("some-topic", function (data) {});
off(topic, [callback])
: Remove a callback function for a specified topic.
topic
: The name of the topic to unsubscribe from.callback
(optional): The callback function to remove, or don't provide in order to remove all callback functions for the topic
topic.hermes.off("some-topic", callbackFunction);
hermes.off("some-topic");
MIT License
FAQs
client-side messaging channel for sending data from one browser tab to another
The npm package hermes-channel receives a total of 6,116 weekly downloads. As such, hermes-channel popularity was classified as popular.
We found that hermes-channel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.