MCPcopy Create free account
hub / github.com/codecombat/codecombat / updateVolume

Method updateVolume

app/views/play/CampaignView.js:2193–2207  ·  view source on GitHub ↗
(volume)

Source from the content-addressed store, hash-verified

2191 }
2192
2193 updateVolume (volume) {
2194 volume = volume ?? me.get('volume') ?? 1.0
2195 const button = $('#volume-button', this.$el)
2196 button.toggleClass('vol-off', volume <= 0.0)
2197 button.toggleClass('vol-down', volume > 0.0 && volume < 1.0)
2198 button.toggleClass('vol-up', volume >= 1.0)
2199 createjs.Sound.volume = volume === 1 ? 0.6 : volume // Quieter for now until individual sound FX controls work again.
2200 if (volume !== me.get('volume')) {
2201 me.set('volume', volume)
2202 me.patch()
2203 if (volume) {
2204 this.playAmbientSound()
2205 }
2206 }
2207 }
2208
2209 onToggleVolume (e) {
2210 const button = $(e.target).closest('#volume-button')

Callers 2

afterRenderMethod · 0.95
onToggleVolumeMethod · 0.95

Calls 4

playAmbientSoundMethod · 0.95
patchMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected