Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.03'
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch88 committed May 9, 2016
2 parents 991a8f6 + 235bfcc commit 22747db
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,49 @@ npm install pigeonjs
WIP

#How to use

##Global
```javascript
// Register a new channel
pigeon.channel('my-channel');

// Verify if my channel was created
pigeon.has('my-channel'); // returns a boolean

// Get a list of all subscribers of my channel
pigeon.channel('my-channel').subscribers;

// Get a list of all subscribers of my channel
pigeon.channel('my-channel').subscribe('item:updated', () => {
// Callback function
});

// Removes my subscriber
let disposer = pigeon.channel('my-channel').subscribe('item:updated', () => {...});
disposer();

// Publish an event
pigeon.channel('my-channel').publish('item:updated', data);

// Create a new channel
let channel = pigeon.channel();
```

##Local custom channel

```javascript
// Create your own custom channel
let customChannel = pigeon.createCustomChannel()

// Add a subscriber
channel.subscribe('user:create')(() => {...});
customChannel.subscribe('user:create')(() => {...});

// Dispose your subscriber
let disposer = channel.subscribe('user:create')(() => {...});
let disposer = customChannel.subscribe('user:create')(() => {...});
disposer();

// Publish your message or date
channel.publish('user:create')('an example message');
customChannel.publish('user:create')('an example message');
```

#License
Expand Down
2 changes: 1 addition & 1 deletion dist/pigeon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/pigeon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/pigeon.min.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pigeonjs",
"version": "0.0.2",
"version": "0.0.3",
"description": "This is an in-memory message bus. Very slim and fast",
"main": "./dist/pigeon.min.js",
"typings": "./pigeon.d.ts",
Expand Down Expand Up @@ -35,8 +35,8 @@
"chai": "^3.5.0",
"karma": "^0.13.21",
"karma-chai": "^0.1.0",
"karma-coverage": "^0.5.3",
"karma-growl-reporter": "^0.1.1",
"karma-coverage": "^1.0.0",
"karma-growl-reporter": "^1.0.0",
"karma-mocha": "^1.0.1",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sinon": "^1.0.4",
Expand Down

0 comments on commit 22747db

Please sign in to comment.