Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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