sdc-pubsub first commit
[sdc/sdc-pubsub.git] / README.md
1 ## sdc-pubsub
2
3 sdc-pubsub [npm](https://www.npmjs.com/package/sdc-pubsub) package.
4
5 ### Installation
6
7 Installing using npm:
8
9 ```
10 npm install sdc-pubsub
11 ```
12
13 ### Loading It Up
14 #### ES6
15 ```javascript
16 import {PluginPubSub} from 'sdc-pubsub'
17 ```
18 #### ES5
19
20 ```javascript
21 var pluginPubSub = require('PluginPubSub')
22 ```
23
24 ### Usage
25 #### Initialize a pubsub client
26 ```javascript
27 //eventsClientId=<received from query params>
28 //parentUrl=<received from query params>
29 //eventsToWaitFor = [ “CHECK_IN” ]
30
31 var client = new PluginPubSub('eventsClientId, parentUrl, eventsToWaitFor')
32 ```
33
34 #### Notify about events
35 ```javascript
36 client.notify(“READY”)
37 ```
38
39 #### Register for an event
40 ```javascript
41 client.on((eventData,event) => {
42       if(eventData.type == ”WINDOW_OUT”) {
43                              //do logic
44        }
45    }
46 )
47 ```
48
49 ### Dependencies
50
51 * None.
52
53 ### Tests
54
55 None.
56
57 ### Authors
58
59 * Idan Amit: [https://wiki.onap.org/display/~idanamit](hhttps://wiki.onap.org/display/~idanamit)
60
61
62 ### Links
63
64 sdc onap wiki [https://wiki.onap.org/x/_TX0](https://wiki.onap.org/x/_TX0)
65
66 ### License
67
68 Copyright 2018 AT&T, Inc.
69
70 Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0