From 9bdf022bed0d0e04d10bb9eaa54fc81486ccc4c6 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Tue, 22 Nov 2022 18:49:37 +0000 Subject: [PATCH] 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. --- src/sound/BaseSoundManager.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/sound/BaseSoundManager.js b/src/sound/BaseSoundManager.js index 2d8254edb..d13df3c99 100644 --- a/src/sound/BaseSoundManager.js +++ b/src/sound/BaseSoundManager.js @@ -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); + } }, /**