fix: remove event listener when leaving file page
This commit is contained in:
parent
26f1227b89
commit
85d17b607e
1 changed files with 3 additions and 0 deletions
|
@ -90,6 +90,9 @@ class MediaPlayer extends React.PureComponent<Props, State> {
|
|||
|
||||
componentWillUnmount() {
|
||||
const mediaElement = this.mediaContainer.current.children[0];
|
||||
|
||||
document.removeEventListener('keydown', this.togglePlay);
|
||||
|
||||
if (mediaElement) {
|
||||
mediaElement.removeEventListener('click', this.togglePlay);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue