1
0
Fork 0

Fix reject bug

This commit is contained in:
Starbeamrainbowlabs 2017-07-31 19:14:28 +01:00
parent 5913a28f87
commit 3f94b0e65a
1 changed files with 4 additions and 1 deletions

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