The BaseSoundManager.getAll method used to require a key parameter, to return Sounds matching the key. This is now optional and if not given, all Sound instances are returned.

This commit is contained in:
Richard Davey 2022-11-22 18:49:37 +00:00
parent b15880bdea
commit 9bdf022bed

View file

@ -233,7 +233,10 @@ var BaseSoundManager = new Class({
},
/**
* Gets all sounds in this Sound Manager that match the given key.
* Gets all sounds in this Sound Manager.
*
* You can optionally specify a key, in which case only Sound instances that match the given key
* will be returned.
*
* @method Phaser.Sound.BaseSoundManager#getAll
* @since 3.23.0
@ -241,13 +244,20 @@ var BaseSoundManager = new Class({
* @generic {Phaser.Sound.BaseSound} T
* @genericUse {T[]} - [$return]
*
* @param {string} key - Sound asset key.
* @param {string} [key] - Optional asset key. If given, only Sound instances with this key will be returned.
*
* @return {Phaser.Sound.BaseSound[]} - The sounds, or an empty array.
*/
getAll: function (key)
{
return GetAll(this.sounds, 'key', key);
if (key)
{
return GetAll(this.sounds, 'key', key);
}
else
{
return GetAll(this.sounds);
}
},
/**