* 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)
| 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. |
nothing calls this directly
no test coverage detected