diff --git a/soundbox.js b/soundbox.js index df152d0..1a029f8 100644 --- a/soundbox.js +++ b/soundbox.js @@ -5,7 +5,7 @@ function SoundBox() { if(typeof callback == "function") this.sounds[sound_name].addEventListener("canplaythrough", callback); else - return new Promise((resolve, reject) => this.sounds[sound_name].addEventListener("canplaythrough", resolve)); + return new Promise((resolve, reject) => this.sounds[sound_name].addEventListener("canplaythrough", resolve), this.sounds[sound_name].addEventListener("error", reject)); }; this.remove = function(sound_name) {