-
Notifications
You must be signed in to change notification settings - Fork 21
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
fix: Remove target availability event listener on dispose (#29) #35
fix: Remove target availability event listener on dispose (#29) #35
Conversation
52bb4e2
to
d20dc68
Compare
9865dbb
to
61bb196
Compare
src/js/components/AirPlayButton.js
Outdated
if (event.availability === 'available') { | ||
self.show(); | ||
} else { | ||
self.hide(); | ||
} | ||
} | ||
|
||
mediaEl.addEventListener('webkitplaybacktargetavailabilitychanged', onTargetAvailabilityChanged, this); |
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.
One other thing I missed in the previous review: The third parameter to the addEventListener
method is either an options object or a boolean flag, not a reference to this
: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
We should just remove the third parameter here and below. The onTargetAvailabilityChanged
handler has access to the proper this
via the self
variable.
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.
Fixed. 👍 Thanks!
) Fix for issue silvermine#29. This commit removes the "webkitplaybacktargetavailabilitychanged" event listener when the component is disposed. It also provides a test case demo in which the user can remove (dispose) the AirPlay component from the videoJS player.
61bb196
to
ea0880d
Compare
Fix for issue #29.
This commit removes the "webkitplaybacktargetavailabilitychanged" event listener when the component is disposed. It also provides a test case demo in which the user can remove (dispose) the AirPlay component from the videoJS player.