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

Update minified version

This commit is contained in:
Starbeamrainbowlabs 2017-07-31 18:59:01 +01:00
parent eb7c27789e
commit 5b19eadb79

2
soundbox.min.js vendored
View file

@ -1 +1 @@
function SoundBox(){this.sounds={},this.load=function(a,b,c){return this.sounds[a]=new Audio(b),"function"==typeof c?void this.sounds[a].addEventListener("canplaythrough",c):new Promise(d=>this.sounds[a].addEventListener("canplaythrough",d),this.sounds[a].addEventListener("error",reject))},this.remove=function(a){"undefined"!=typeof this.sounds&&delete this.sounds[a],"function"==typeof this.sound_callbacks&&delete this.sound_callbacks[a]},this.play=function(a,b){if("undefined"==typeof this.sounds[a])return console.error("Can't find sound called '"+a+"'."),!1;var c=this.sounds[a].cloneNode(!0);return c.play(),"function"==typeof b?(console.log("Adding callback"),c.addEventListener("ended",b),!0):(console.log("Returning promise"),new Promise(d=>c.addEventListener("ended",d)))}} function SoundBox(){this.sounds={},this.load=function(a,b,c){return this.sounds[a]=new Audio(b),"function"==typeof c?void this.sounds[a].addEventListener("canplaythrough",c):new Promise(d=>this.sounds[a].addEventListener("canplaythrough",d),this.sounds[a].addEventListener("error",reject))},this.remove=function(a){"undefined"!=typeof this.sounds&&delete this.sounds[a],"function"==typeof this.sound_callbacks&&delete this.sound_callbacks[a]},this.play=function(a,b){if("undefined"==typeof this.sounds[a])return console.error("Can't find sound called '"+a+"'."),!1;var c=this.sounds[a].cloneNode(!0);return c.play(),"function"==typeof b?(console.log("Adding callback"),c.addEventListener("ended",b),!0):(console.log("Returning promise"),new Promise(d=>c.addEventListener("ended",d)))}}SoundBox.version="0.2";