Skip to content

Commit c0c6e39

Browse files
Updating play method to return boolean indicating if play call was done successfully
1 parent 5aec2e4 commit c0c6e39

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/sound/BaseSound.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ var BaseSound = new Class({
260260
* @method Phaser.Sound.BaseSound#play
261261
* @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound.
262262
* @param {ISoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
263-
* @returns {ISound | null} This sound instance or 'null' if an error occurred.
263+
* @returns {boolean} Whether the sound started playing successfully.
264264
*/
265265
play: function (markerName, config) {
266266
if (markerName === void 0) { markerName = ''; }
@@ -270,7 +270,7 @@ var BaseSound = new Class({
270270
}
271271
if (typeof markerName !== 'string') {
272272
console.error('Sound marker name has to be a string!');
273-
return null;
273+
return false;
274274
}
275275
if (!markerName) {
276276
this.currentMarker = null;
@@ -280,7 +280,7 @@ var BaseSound = new Class({
280280
else {
281281
if (!this.markers[markerName]) {
282282
console.error('No marker with name \'' + markerName + '\' found for sound \'' + this.key + '\'!');
283-
return null;
283+
return false;
284284
}
285285
this.currentMarker = this.markers[markerName];
286286
this.currentConfig = this.currentMarker.config;
@@ -290,7 +290,7 @@ var BaseSound = new Class({
290290
this.currentConfig = Extend(this.currentConfig, config);
291291
this.isPlaying = true;
292292
this.isPaused = false;
293-
return this;
293+
return true;
294294
},
295295
/**
296296
* Pauses the sound.

0 commit comments

Comments
 (0)