Throw away sound effects in Javascript using HTML5 audio?
I'm building a simple game using a canvas tag and want to add some sound effects to it. If I use the following code to play the SFX...
function playSfx( sound ) {
var snd = new Audio("file.mp3");
snd.play();
}
Is the garbage collection / memory management clever enough to play the sound and then dispose of the Audio object? Or will I have to keep track of the object and destroy it开发者_C百科 when it has finished playing?
精彩评论