Socket
Socket
Sign inDemoInstall

broadcastchannel-polyfill

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    broadcastchannel-polyfill

Polyfill for BroadcastChannel for Safari, old Chrome and Opera


Version published
Maintainers
1
Install size
6.99 kB
Created

Readme

Source

BroadcastChannel polyfill

This is a polyfill for BroadcastChannel.

It is just a published copy of Joshua Bell's gist (since broadcast-channel polyfill won't work for our project).

It requires Message Channel support, so should work in:

  • Chrome 4+
  • Safari 5+
  • Opera 11.5+

Does not work in:

  • Firefox 37- (neither BroadcastChannel nor MessageChannel)
  • IE (??)

Caveats

  • The real API should let you transmit anything which can copied by the structured cloning algorithm. This polyfill only copies things using JSON.stringify()/JSON.parse() so it is much more limited.
  • This polyfill uses DOM Storage (localStorage) and storage events. DOM Storage is a synchronous API and so may cause performance issues in pages. In addition, it is not exposed to Workers. Therefore, the polyfill will not function in Workers.
  • Unique storage keys are used for each message, and are cleaned up a few hundred milliseconds after transmission. This is a total hack and may result in the messages failing to be received (if the write and delete are coalesced) or persisting (if the cleanup is prevented by page close).

Keywords

FAQs

Last updated on 11 Mar 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc