Skip to content

Instantly share code, notes, and snippets.

Created June 30, 2018 03:22
What would you like to do?
Delay with async/await
const delay = time =>
new Promise(resolve => setTimeout(resolve, time));
const sendRequest = async () => {
await delay(1000);
return axios.get(API_URL);
// request fires after 1 second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment