New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hermes-channel

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hermes-channel

Messaging channel between tabs

  • 0.0.2
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NPM

install size dependencies

hermes-channel

A messaging channel for sending data between specific topic listeners. This works between browsing contexts (that is, windows, tabs, frames, or iframes) and workers of the same origin.

TOC

Install

npm i hermes --save
yarn add hermes

Import

import hermes from "hermes-channel";

API

  • 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");
    hermes.send("some-topic", { title: "awesome" });
    hermes.send("some-topic", { title: "awesome" }, true);
    
  • 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");
    

FAQs

Package last updated on 15 Feb 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc