Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

framebus

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

framebus

Framebus allows you to easily send messages across frames (and iframes) with a simple bus.

  • 6.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
130K
decreased by-52.64%
Maintainers
0
Weekly downloads
 
Created

What is framebus?

Framebus is a lightweight JavaScript library for cross-frame communication. It allows you to send and receive messages between different browsing contexts, such as iframes, windows, or tabs, using a simple event-based API.

What are framebus's main functionalities?

Publishing Events

This feature allows you to publish events to other frames. The `emit` method sends an event with a specified name and data payload to any listeners in other frames.

const framebus = require('framebus');

framebus.emit('eventName', { key: 'value' });

Subscribing to Events

This feature allows you to subscribe to events from other frames. The `on` method listens for an event with a specified name and executes a callback function when the event is received.

const framebus = require('framebus');

framebus.on('eventName', (data) => {
  console.log(data); // { key: 'value' }
});

Unsubscribing from Events

This feature allows you to unsubscribe from events. The `off` method removes a previously registered event listener, preventing the callback from being executed when the event is emitted.

const framebus = require('framebus');

const callback = (data) => {
  console.log(data);
};

framebus.on('eventName', callback);

// Later, to unsubscribe
framebus.off('eventName', callback);

Other packages similar to framebus

FAQs

Package last updated on 05 Jul 2024

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