-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Added WebTorrent add and remove events and docs update #2766
Conversation
I added a WebTorrent bug fix that was made apparent while testing my initial pull request, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me and works as expected in local testing, fixing #2767.
I've suggested some small changes to pass linting, once made, will be happy to approve.
Co-authored-by: Brad Marsden <silentbot1@gmail.com>
Co-authored-by: Brad Marsden <silentbot1@gmail.com>
I made the requested changes. Not sure if I missed something. It says "Merging is blocked" "Merging can be performed automatically once the requested changes are addressed." |
What is the purpose of this pull request? (put an "X" next to item)
[X] Documentation update
[ ] Bug fix
[X] New feature
[ ] Other, please explain:
What changes did you make? (Give an overview)
Added the events 'add' and 'remove' that are fired when a torrent is added to or removed from client.torrents.
This allows attaching to torrent events that may be emitted before the client 'torrent' event is emitted.
I am in a situation where I want to use a custom wire extension on every torrent. I initially tried to listen on the client.on('torrent') event but sometimes the Torrent 'wire' event was firing before the 'torrent' event so it was missed, and my wire extension could not be added via wire.use(). Attaching a 'wire' event handler to the torrent immediately after getting it from client.add() and client.seed() avoided this issue but it meant this had to be done to the torrent after calling client.add or client.seed. Which makes using and sharing custom wire extensions more cumbersome than it needs to be.
Is there anything you'd like reviewers to focus on?
This is a very simple modification. I have added an update to the docs and the code.