Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
Created June 27, 2024 09:41
Show Gist options
  • Save d1i1m1o1n/65d24826e0701a536222478d22484203 to your computer and use it in GitHub Desktop.
Save d1i1m1o1n/65d24826e0701a536222478d22484203 to your computer and use it in GitHub Desktop.
A simple way to create a helper to wait for a specified time. It can be useful for simulation of server response and other purposes during development.
const wait = async (milliseconds) => new Promise(
(resolve) => setTimeout(resolve, milliseconds)
);
wait(2000).then(doSomthing);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment