Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc for peer event #689

Merged
merged 3 commits into from Sep 20, 2019

Conversation

@phillmac
Copy link
Member

phillmac commented Sep 19, 2019

Couldn't find any docs for

if (getStore(address)) { getStore(address).events.emit('peer', peer) }

I wasn't aware such an event existed, however I think it could be an incredibly useful event in some cases, so here's some docs to match

@phillmac phillmac changed the title Add doc for `peer` event Add doc for peer event Sep 19, 2019
API.md Outdated
db.events.on('peer', (peer) => ... )
```

Emitted when a new peer connects via ipfs pubsub. *peer* is the new peer, an instance of [`peerInfo`](https://github.com/libp2p/js-peer-info)

This comment has been minimized.

Copy link
@shamb0t

shamb0t Sep 19, 2019

Member

Is peer an instance of peerInfo or is it just the peer-id string?

This comment has been minimized.

Copy link
@phillmac

phillmac Sep 19, 2019

Author Member

I didn't check back far enough into the js-ipfs implementation. Seems like its just the peer-id string.

@shamb0t

This comment has been minimized.

Copy link
Member

shamb0t commented Sep 19, 2019

Good catch @phillmac and thanks for the PR! Just left one question re: the type of peer, is it an instance of peerInfo or a string?

phillmac added 2 commits Sep 19, 2019
@shamb0t shamb0t merged commit 343af12 into master Sep 20, 2019
1 check passed
1 check passed
ci/circleci Your tests passed on CircleCI!
Details
@shamb0t

This comment has been minimized.

Copy link
Member

shamb0t commented Sep 20, 2019

Thanks @phillmac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.