Created
April 19, 2019 23:16
-
-
Save suissa/ac3402b1d271977d134c12066ba2f7cc to your computer and use it in GitHub Desktop.
wait with Promise and setTimeout
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 wait = (timeout) => (new Promise(resolve => setTimeout(resolve, timeout))) | |
const fn = () => console.log('oii') | |
wait(5000).then(fn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment