mirror of
https://github.com/danbulant/slightlyComplicatedTicTacToe
synced 2026-05-19 04:08:52 +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() {
|
||||
if (!this.track) return;
|
||||
this.track.addEventListener('canplay', this.onCanPlay.bind(this));
|
||||
|
||||
const handleTrackCanPlay = this.onCanPlay.bind(this);
|
||||
this.track.addEventListener('canplay', handleTrackCanPlay);
|
||||
|
||||
return () => {
|
||||
if (!this.track) return;
|
||||
|
||||
this.track.removeEventListener('canplay', this.onCanPlay.bind(this));
|
||||
this.track.removeEventListener('canplay', handleTrackCanPlay);
|
||||
this.offCanPlay();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue