Skip to content

Commit 8f9eafd

Browse files
Defined mute property for HTML5AudioSound class
1 parent 495a79d commit 8f9eafd

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var Class = require('../../utils/Class');
22
var BaseSound = require('../BaseSound');
3+
var SoundValueEvent = require('../SoundValueEvent');
34
var HTML5AudioSound = new Class({
45
Extends: BaseSound,
56
initialize: function HTML5AudioSound(manager, key, config) {
@@ -87,4 +88,20 @@ var HTML5AudioSound = new Class({
8788
}
8889
}
8990
});
91+
/**
92+
* Mute setting.
93+
*
94+
* @name Phaser.Sound.HTML5AudioSound#mute
95+
* @property {boolean} mute
96+
*/
97+
Object.defineProperty(HTML5AudioSound.prototype, 'mute', {
98+
get: function () {
99+
return this.currentConfig.mute;
100+
},
101+
set: function (value) {
102+
this.currentConfig.mute = value;
103+
this.setMute();
104+
this.events.dispatch(new SoundValueEvent(this, 'SOUND_MUTE', value));
105+
}
106+
});
90107
module.exports = HTML5AudioSound;

0 commit comments

Comments
 (0)