1
0
Fork 0
mirror of https://github.com/sbrl/soundbox.git synced 2018-01-10 21:33:43 +00:00

Fix reject bug

This commit is contained in:
Starbeamrainbowlabs 2017-07-31 19:14:28 +01:00
parent 5913a28f87
commit 3f94b0e65a

View file

@ -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) {