0.0.72 • Published 5 years ago

immutable-bus v0.0.72

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Immutable Bus

A communication bus for cross-document communication based on pub/sub model.

Install

  npm install immutable-bus
  

To publish

    import { ImmutableBus } from 'immutable-bus';
    
    let immutableBus = new ImmutableBus("http://self");
    immutableBus.connectTo("http://window-1");
    immutableBus.publish("message-topic", 
        "http://window-1", {
        "msg": "hello from host 1"
    });

To subscribe

    let immutableBus = new ImmutableBus("http://self");
    immutableBus.connectTo("http://window-1");
    immutableBus.connectTo("http://window-2");
    immutableBus.subscribe('message-topic', (data) => {
      console.log(data); //prints any data from either windows
    });

To broadcast (only possible by parent/controller)

    import { ImmutableBus } from 'immutable-bus';

    let immutableBus = new ImmutableBus("http://self");
    immutableBus.broadcast("message-topic", {
        "msg": "hello from controller"
    });
0.0.72

5 years ago

0.0.71

5 years ago

0.0.7

5 years ago

0.0.66

5 years ago

0.0.65

5 years ago

0.0.6

5 years ago

0.0.56

5 years ago

0.0.55

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago