From 35b62d4506da67928627b9adb5f5885d04879b70 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 31 Jul 2017 18:53:56 +0100 Subject: [PATCH] Fix Promise --- soundbox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {