JSFiddle - React, Tailwind, and code Playground
JavaScript
BasicGame.Game = function (game) {
this.score = 0;
this.player;
this.sound;
}
BasicGame.Game.prototype = {
create: function () {
//Do sound stuff...
document.addEventListener("soundStop", function() {
//inside here, "this" is document
//this.sound does not exist
//this.sound.position = 0;
console.log("sound complete");
}.bind(this));
},
update: function () {
},
destroy: function () {
}
}