share an event emitter among pages and frames on the same domain
This module works offline and does not rely on any network IO.
Behind the scenes, the localStorage API and the window
'storage' event is used to synchronize
Previously this module used a shared worker, but shared workers need to elect a
master for the
URL.createObjectURL() api which got very complicated.
Just create a bus, which returns an event emitter:
var createBus = ;var bus = ;bus;bus;
Compile with browserify then open this page up on a few tabs.
The messages get shared hooray!
var createBus =
Create a new event emitter
opts.key- the string key to save data. default:
'page-bus'. By using a different value, you can create namespaces.
All other pages on the same domain in the same browser will be able to open the event emitter.
With npm do:
npm install page-bus