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

burrata

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

burrata

Robust, developer-friendly postMessage.

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source

Burrata

npm Dependencies Build Status Coverage Status JavaScript Standard Style

Robust, developer-friendly postMessage.

Usage

  1. Load dist/burrata.js with a <script> tag. This will put the burrata object on the window.

  2. Create an instance of Master, register some commands, and call init() to listen for commands from slaves:

    const master = new burrata.Master()
    
    // Register the "echo" command, which sends back the value of the "msg" arg.
    master.setHandler('echo', async ({ msg }) => {
      return msg
    })
    
    // Start listening for commands.
    master.init()
    
  3. Add an <iframe> for each slave. In the iframe HTML document, load burrata.js again and set up the slave:

    // Choose a unique ID for this slave.
    const id = '123'
    const slave = new burrata.Slave(id)
    
    // Connect to master.
    await slave.init()
    
    // Call "echo" on master and print the result.
    const response = await slave.send('echo', { msg: 'Hello!' })
    console.log('Response: ' + response)
    

Slaves can define command handlers using the same API. See the demo for more examples.

Known Issues

  • Coverage reporting is currently broken.

Author

Tim De Pauw

License

MIT

FAQs

Package last updated on 17 Jun 2018

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