Giter Site home page Giter Site logo

seyyedkhandon / broadcastchannel-polyfill Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jsmith01/broadcastchannel-polyfill

0.0 0.0 0.0 7 KB

Simple BroadcastChannel polyfill for browsers with MessageChannel API onboard

License: The Unlicense

JavaScript 100.00%

broadcastchannel-polyfill's Introduction

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).

broadcastchannel-polyfill's People

Contributors

greli avatar jsmith01 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.