1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 23:40:57 +01:00
phorge-phorge/webroot/rsrc/externals/javelin/lib/Sound.js

39 lines
578 B
JavaScript
Raw Normal View History

/**
* @requires javelin-install
* @provides javelin-sound
* @javelin
*/
JX.install('Sound', {
statics: {
_sounds: {},
load: function(uri) {
var self = JX.Sound;
if (!(uri in self._sounds)) {
self._sounds[uri] = JX.$N(
'audio',
{
src: uri,
preload: 'auto'
});
}
},
play: function(uri) {
var self = JX.Sound;
self.load(uri);
var sound = self._sounds[uri];
try {
sound.play();
} catch (ex) {
JX.log(ex);
}
}
}
});