Skip to content

Instantly share code, notes, and snippets.

@tywong
Created August 17, 2016 07:47
Show Gist options
  • Save tywong/3b0571393dd31675cd80dda3823444ef to your computer and use it in GitHub Desktop.
Save tywong/3b0571393dd31675cd80dda3823444ef to your computer and use it in GitHub Desktop.
function timeout(sec) {
if(sec == 0)
return Promise.resolve();
return new Promise(
(fulfill, reject) => {
setTimeout(
() => fulfill(Promise.resolve()),
sec * 1000
)
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment