Skip to content

Commit

Permalink
refactor(media_control_element): avoid listener leaks after destroy o…
Browse files Browse the repository at this point in the history
…ne component
  • Loading branch information
joaopaulovieira committed Apr 27, 2021
1 parent bee3027 commit 80ad4ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/base/media_control_component/media_control_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ export default class MediaControlComponentPlugin extends UICorePlugin {

constructor(core) {
super(core)
this.$el[0].addEventListener('click', e => { e.stopPropagation() })
this._stopPropagation = e => { e.stopPropagation() }
this.$el[0].addEventListener('click', this._stopPropagation)
this.$el[0].classList.add('media-control__elements')
}

destroy() {
this._mediaControl = null
this.$el[0].removeEventListener('click', this._stopPropagation)
super.destroy()
}

Expand Down

0 comments on commit 80ad4ae

Please sign in to comment.