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:
parent
5913a28f87
commit
3f94b0e65a
1 changed files with 4 additions and 1 deletions
|
@ -13,7 +13,10 @@ function SoundBox() {
|
||||||
if(typeof callback == "function")
|
if(typeof callback == "function")
|
||||||
this.sounds[sound_name].addEventListener("canplaythrough", callback);
|
this.sounds[sound_name].addEventListener("canplaythrough", callback);
|
||||||
else
|
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) {
|
this.remove = function(sound_name) {
|
||||||
|
|
Loading…
Reference in a new issue