Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
docs: update example on the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Dec 30, 2016
1 parent 7fa767c commit 61ceb8c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ const FloodSub = require('libp2p-floodsub')

const fsub = new FloodSub(libp2pNodeInstance)

fsub.on('fruit', (data) => {
console.log(data)
fsub.start((err) => {
if (err) {
console.log('Upsy', err)
}
fsub.on('fruit', (data) => {
console.log(data)
})
fsub.subscribe('fruit')

fsub.publish('fruit', new Buffer('banana'))
})
fsub.subscribe('fruit')

fsub.publish('fruit', new Buffer('banana'))
```

## API
Expand Down

0 comments on commit 61ceb8c

Please sign in to comment.