bazaar
v0.2.5
Published
A publish-subscribe (broadcast-listen) layer for same-origin inter-window communication
Downloads
19
Readme
Bazaar
Description: A publish-subscribe (broadcast-listen) layer for same-origin inter-window communication. Let's you broadcast messages to all opened windows, which are listening.
Home page: jakut.is/git/BAZAAR/about
License: MIT
Author: Vytautas Jakutis
Example usage
// '/bazaar-worker.js' specifies the url of worker script
// 'hub1' specifies the namespace, this argument is optional, default is '__bazaar__'
var hub = window.bazaar('/bazaar-worker.js', 'hub1');
if(hub === null) {
alert('your web browser is not supported');
} else {
document.onmousedown = function() {
hub.broadcast(new Date().getTime());
};
hub.listen(function(err, ts) {
if(err) {
return alert("An error occurred when receiving a message.");
}
alert(ts);
});
}
Supported browsers
- Mozilla Firefox 2.0+
- Opera 10.50+
- Google Chrome 5+
- Microsoft Internet Explorer 6+
- Apple Safari 4.0+