Added utility method forEachActiveSound that enables traversing only active (not destroyed) sounds

This commit is contained in:
Pavle Goloskokovic 2018-01-04 19:51:54 +01:00
parent b3fad218bc
commit c424b61939

View file

@ -215,6 +215,19 @@ var BaseSoundManager = new Class({
sound.destroy();
});
this.sounds = null;
},
/**
* @private
* @param {(value: ISound, index: number, array: ISound[]) => void} callbackfn
* @param thisArg
*/
forEachActiveSound: function (callbackfn, thisArg) {
var _this = this;
this.sounds.forEach(function (sound, index) {
if (!sound.pendingRemove) {
callbackfn.call(thisArg || _this, sound, index, _this.sounds);
}
});
}
});
/**