Skip to content

Instantly share code, notes, and snippets.

@negamaxi
Created December 21, 2017 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save negamaxi/6b3231fed50bd3a3ef3ed063123a900b to your computer and use it in GitHub Desktop.
Save negamaxi/6b3231fed50bd3a3ef3ed063123a900b to your computer and use it in GitHub Desktop.
Async timeout
const asyncTimeout = (timeout) => new Promise(
resolve => setTimeout(resolve, timeout)
)
export default asyncTimeout
import asyncTimeout from './asyncTimeout'
const asyncFunction = async () => {
await asyncTimeout(10000)
// DO STUFF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment