mirror of
https://github.com/danbulant/slightlyComplicatedTicTacToe
synced 2026-07-06 11:40:36 +00:00
maintain function reference
This commit is contained in:
parent
8b130113ee
commit
98bbaf402a
1 changed files with 4 additions and 2 deletions
|
|
@ -20,12 +20,14 @@ export default class GameAudio {
|
||||||
|
|
||||||
onMount() {
|
onMount() {
|
||||||
if (!this.track) return;
|
if (!this.track) return;
|
||||||
this.track.addEventListener('canplay', this.onCanPlay.bind(this));
|
|
||||||
|
const handleTrackCanPlay = this.onCanPlay.bind(this);
|
||||||
|
this.track.addEventListener('canplay', handleTrackCanPlay);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (!this.track) return;
|
if (!this.track) return;
|
||||||
|
|
||||||
this.track.removeEventListener('canplay', this.onCanPlay.bind(this));
|
this.track.removeEventListener('canplay', handleTrackCanPlay);
|
||||||
this.offCanPlay();
|
this.offCanPlay();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue