Skip to content

Instantly share code, notes, and snippets.

@CodeLenny
Created August 22, 2017 14:33
Show Gist options
  • Save CodeLenny/80fc0afee9974530b44df3acd06fa8a3 to your computer and use it in GitHub Desktop.
Save CodeLenny/80fc0afee9974530b44df3acd06fa8a3 to your computer and use it in GitHub Desktop.
<script>
/**
* Delays the given number of milliseconds.
* @param {Number} ms the number of milliseconds to delay.
* @return {Promise} resolves after the delay has finished.
*/
Promise.delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment