Last active
April 20, 2019 16:07
-
-
Save dtothefp/d6808778647b9fdf30d6f3731c51c8c4 to your computer and use it in GitHub Desktop.
Simple Async Timer
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 = (duration = 100) => new Promise((res) => setTimeout(res, duration)); | |
export default async (duration = 500) => { | |
console.log('Wait for: ', durtaion); | |
await wait(duration); | |
console.log('Finished after: ', durtaion); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment