Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakutis/bazaar
A publish-subscribe (broadcast-listen) layer for same-origin inter-window communication.
https://github.com/jakutis/bazaar
Last synced: 6 days ago
JSON representation
A publish-subscribe (broadcast-listen) layer for same-origin inter-window communication.
- Host: GitHub
- URL: https://github.com/jakutis/bazaar
- Owner: jakutis
- License: mit
- Created: 2014-02-18T14:19:11.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-18T19:38:17.000Z (almost 11 years ago)
- Last Synced: 2024-11-14T23:09:57.553Z (2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.org/package/bazaar
- Size: 164 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# bazaar
A publish-subscribe (broadcast-listen) layer for same-origin inter-window communication.
- [Overview](#overview)
- [Installation](#installation)
- [API](#api)
- [Development](#development)## Overview
* Let's you broadcast messages to all opened windows, which are listening.
* Tested on these web browsers:
* Mozilla Firefox 2.0+
* Opera 10.50+
* Google Chrome 5+
* Microsoft Internet Explorer 6+
* Apple Safari 4.0+## Installation
Install manually by adding to your HTML file:
Install with [npm](https://www.npmjs.org/package/bazaar):
$ npm install --save bazaar
Install with [component](http://component.io/jakutis/bazaar):
$ component install jakutis/bazaar
Install with [bower](http://bower.io):
$ bower install --save bazaar
## API
[demo code](https://jakut.is/demos/bazaar/)
// '/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);
});
}## Development
TODO