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

When closing streams, also unbind from all events. #1250

Merged
merged 3 commits into from
Aug 29, 2018
Merged

When closing streams, also unbind from all events. #1250

merged 3 commits into from
Aug 29, 2018

Conversation

kekkokk
Copy link
Contributor

@kekkokk kekkokk commented Jun 28, 2018

Description

When closing a stream we are currently NOT unbinding from this:

stream.on('added', dispatchStreamSubscribed.bind(null, stream));

Steps to reproduce:
tab 1) Publisher
tab 2) subscriber. Subscribe to remote stream, then unsubscribe, then subscribe again. 2 stream added events are fired

[] It needs and includes Unit Testsì
Changes in Client or Server public APIs
[] It includes documentation for these changes in /doc.

Copy link
Contributor

@jcague jcague left a comment

Choose a reason for hiding this comment

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

good catch! thanks a lot for the contribution. I just have a couple of minor comments.

@@ -49,6 +49,7 @@ const EventDispatcher = () => {
that.on = that.addEventListener;
that.off = that.removeEventListener;
that.emit = that.dispatchEvent;
that.unbindEvents = () => { dispatcher.eventListeners = {}; };
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that a name like removeAllListeners() would be more similar to the rest of methods here. wdyt?

Could you also move it to line ~35, just below removeEventListener() {...} block.

Copy link
Contributor

@jcague jcague left a comment

Choose a reason for hiding this comment

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

LGTM

@jcague jcague merged commit fc5d092 into lynckia:master Aug 29, 2018
@kekkokk kekkokk deleted the fix/remove_eventslisteners branch September 5, 2018 10:27
Arri98 pushed a commit to Arri98/licode that referenced this pull request Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants