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
Merged

Add doc for peer event #689

merged 3 commits into from Sep 20, 2019

Conversation

@phillmac
Copy link
Member

@phillmac 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)
Copy link
Member

@shamb0t shamb0t Sep 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

@phillmac phillmac Sep 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@shamb0t
Copy link
Member

@shamb0t 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?

@shamb0t shamb0t merged commit 343af12 into master Sep 20, 2019
1 check passed
@shamb0t
Copy link
Member

@shamb0t 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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants