This is a polyfill for BroadcastChannel.
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 (??)
- The real API should let you transmit anything which can copied by the structured cloning algorithm. This polyfill only copies things using
JSON.parse()so it is much more limited.
- This polyfill uses DOM Storage (
storageevents. 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).