Skip to content

Commit

Permalink
made old sounds removed on adding new sound
Browse files Browse the repository at this point in the history
  • Loading branch information
starwarswii committed Feb 26, 2020
1 parent e769e8d commit 29aeb66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion public/js/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ export default class Cell {
this.keyButton.html(" ");
}

//TODO this will probably do more stuff later
assign(sound) {
//if there was an existing sound, remove it
if (this.sound !== null) {
this.sound.unload();
}

this.sound = sound;
//we need to check this, in case the mode was switched to loop before a sound was loaded
this.sound.loop(this.mode === modes.LOOP);
Expand Down

0 comments on commit 29aeb66

Please sign in to comment.