From 3f94b0e65a86e2c8bd4e337e9a2bf50ac25479dd Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 31 Jul 2017 19:14:28 +0100 Subject: [PATCH] Fix reject bug --- soundbox.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/soundbox.js b/soundbox.js index f160a1f..231c727 100644 --- a/soundbox.js +++ b/soundbox.js @@ -13,7 +13,10 @@ 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), this.sounds[sound_name].addEventListener("error", reject)); + return new Promise((resolve, reject) => { + this.sounds[sound_name].addEventListener("canplaythrough", resolve); + this.sounds[sound_name].addEventListener("error", reject); + }); }; this.remove = function(sound_name) {