Skip to content

Instantly share code, notes, and snippets.

@David263
Created December 21, 2018 15:11
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 David263/c1fbdb3f82964f048606665eac1ca349 to your computer and use it in GitHub Desktop.
Save David263/c1fbdb3f82964f048606665eac1ca349 to your computer and use it in GitHub Desktop.
A Promise version of setTimeout, to easily add a delay to an asynchronous operation
// Wrap setTimeout in a Promise
function delay(msec,value)
{
return new Promise(function(OKFunction)
{
setTimeout(OKFunction,msec,value);
});
} // delay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment