Created
December 21, 2016 17:50
-
-
Save weslleyaraujo/0265e7fb4389afab4d145451c8870a89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sleep from 'utils/sleep'; | |
const SONG_DELAY_TIME = 400; | |
export const sing = payload => async (dispatch, getState) => { | |
dispatch(startSong()); | |
const { match } = getState(); | |
for (let i = 0; i <= match.all.length - 1; i++) { | |
const id = match.all[i]; | |
dispatch(lightenPad({ id })); | |
await sleep(SONG_DELAY_TIME); // sleep time during note play | |
dispatch(lightenOffPad()); | |
await sleep(SONG_DELAY_TIME); // sleep time before next note | |
} | |
dispatch(finishSong()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment