mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Added utility method forEachActiveSound that enables traversing only active (not destroyed) sounds
This commit is contained in:
parent
b3fad218bc
commit
c424b61939
1 changed files with 13 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue