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

Function playTrack

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

* Plays the specified track. Track must be valid. Noop when already playing. * * @param track {string} name of track to play * @throws {Error} when invalid track specified * @return Array of IDs of the played sounds

({ state, dispatch }, track)

Source from the content-addressed store, hash-verified

159 * @return Array of IDs of the played sounds
160 */
161 playTrack ({ state, dispatch }, track) {
162 const trackData = state.tracks[track]
163 if (!trackData) {
164 throw new Error('Invalid track specified')
165 }
166
167 const plays = Array.from(trackData.keys())
168 .map(id => dispatch('playSound', id))
169
170 return Promise.all(plays)
171 },
172
173 /**
174 * Pauses the specified track. Track must be valid.

Callers

nothing calls this directly

Calls 1

dispatchFunction · 0.85

Tested by

no test coverage detected