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

Function stopAll

app/core/store/modules/audio.js:143–151  ·  view source on GitHub ↗

* Stops all tracks and clears current play data. Removes all * currently playing sounds. Calling stop resets all data on all * tracks regardless of play state for each track. * * @param opts.unload {boolean} Unload sound from memory * * @return Array of sound IDs that

({ state, dispatch }, opts = {})

Source from the content-addressed store, hash-verified

141 * @return Array of sound IDs that were stopped
142 */
143 async stopAll ({ state, dispatch }, opts = {}) {
144 const unload = opts.unload
145
146 const stops = Object.keys(state.tracks)
147 .map(track => dispatch('stopTrack', { track, unload }))
148
149 const ids = await Promise.all(stops)
150 return ids.flat()
151 },
152
153 /**
154 * Plays the specified track. Track must be valid. Noop when already playing.

Callers

nothing calls this directly

Calls 1

dispatchFunction · 0.85

Tested by

no test coverage detected