Skip to content

Instantly share code, notes, and snippets.

@anthify
Created April 8, 2019 08:20
Show Gist options
  • Save anthify/3703d336e723ea86e8bc2b3b4544dcf1 to your computer and use it in GitHub Desktop.
Save anthify/3703d336e723ea86e8bc2b3b4544dcf1 to your computer and use it in GitHub Desktop.
Async Await Delay
export default time =>
new Promise(resolve => setTimeout(() => resolve(), time));
// example
import delay from '.'
const stopAndStart = async () => {
console.log('👋');
await delay(1000);
console.log('🕐, one second later');
};
stopAndStart();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment