Skip to content

Instantly share code, notes, and snippets.

@klikstermkd
Last active May 28, 2016 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klikstermkd/418e52dbe29e043c74d09a452d5a822f to your computer and use it in GitHub Desktop.
Save klikstermkd/418e52dbe29e043c74d09a452d5a822f to your computer and use it in GitHub Desktop.
const arr = [
() => this.setState({moveCircleToMiddle: true}),
1000,
() => this.setState({showGrayCircle: true}),
() => this.setState({showMicrophone: true}),
500,
() => this.setState({moveCircleToTop: true}),
1000,
() => this.setState({pulseGrayCircle: true}),
500,
() => this.setState({okText: 1}),
500,
() => this.setState({okText: 2}),
500,
() => this.setState({googleText: 1}),
500,
() => this.setState({googleText: 2})
];
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
async function sequence(...arr) {
for (const el of arr) {
typeof el === 'function' ? el() : await delay(el);
}
};
sequence.apply(this, arr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment