Skip to content

Commit

Permalink
Merge pull request #1 from pl-numiko/fix/html-video-destroy-method
Browse files Browse the repository at this point in the history
Fix/html video destroy method
  • Loading branch information
pl-numiko authored Oct 13, 2024
2 parents e71a802 + 225da45 commit 12ace5f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
6 changes: 4 additions & 2 deletions dist/js/splide-extension-video.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Splide.js
* Version : 0.8.0
* License : MIT
* Copyright: 2022 Naotoshi Fujita
* Copyright: 2024 Naotoshi Fujita
*/
'use strict';

Expand Down Expand Up @@ -553,7 +553,9 @@ class HTMLVideoPlayer extends AbstractVideoPlayer {
destroy() {
super.destroy();
const { player } = this;
const off = player.addEventListener.bind(player);
if (!player)
return;
const off = player.removeEventListener.bind(player);
off("play", this.onPlay);
off("pause", this.onPause);
off("ended", this.onEnded);
Expand Down
6 changes: 4 additions & 2 deletions dist/js/splide-extension-video.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Splide.js
* Version : 0.8.0
* License : MIT
* Copyright: 2022 Naotoshi Fujita
* Copyright: 2024 Naotoshi Fujita
*/
function empty(array) {
array.length = 0;
Expand Down Expand Up @@ -549,7 +549,9 @@ class HTMLVideoPlayer extends AbstractVideoPlayer {
destroy() {
super.destroy();
const { player } = this;
const off = player.addEventListener.bind(player);
if (!player)
return;
const off = player.removeEventListener.bind(player);
off("play", this.onPlay);
off("pause", this.onPause);
off("ended", this.onEnded);
Expand Down
5 changes: 3 additions & 2 deletions dist/js/splide-extension-video.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/splide-extension-video.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/splide-extension-video.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/types/players/html/HTMLVideoPlayer.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/js/players/html/HTMLVideoPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ export class HTMLVideoPlayer extends AbstractVideoPlayer<HTMLVideoElement> {
super.destroy();

const { player } = this;
const off = player.addEventListener.bind( player );
if ( !player ) return;

const off = player.removeEventListener.bind( player );

off( 'play', this.onPlay );
off( 'pause', this.onPause );
Expand Down

0 comments on commit 12ace5f

Please sign in to comment.