node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป



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:

npm package: bazaar

jam package: bazaar

License: MIT

Author: Vytautas Jakutis

Example usage

demo code

// '/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.");

Supported browsers

  • Mozilla Firefox 2.0+
  • Opera 10.50+
  • Google Chrome 5+
  • Microsoft Internet Explorer 6+
  • Apple Safari 4.0+