Created
May 29, 2016 13:24
-
-
Save JiLiZART/813c2496397543af5f37a8641e890b43 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const values = [ | |
() => console.log({moveCircleToMiddle: true}), | |
1000, | |
() => console.log({showGrayCircle: true}), | |
() => console.log({showMicrophone: true}), | |
5000, | |
() => console.log({moveCircleToTop: true}), | |
1000, | |
() => console.log({pulseGrayCircle: true}), | |
5000, | |
() => console.log({okText: 1}), | |
5000, | |
() => console.log({okText: 2}), | |
5000, | |
() => console.log({googleText: 1}), | |
5000, | |
() => console.log({googleText: 2}) | |
]; | |
const resolve = (el) => new Promise((resolve) => typeof el === 'function' ? resolve(el()) : setTimeout(resolve, el)) | |
const sequence = (values) => values.reduce((prev, cur) => prev.then(resolve(cur)), Promise.resolve()) | |
sequence(values); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment