Skip to content

Instantly share code, notes, and snippets.

@TheRolfFR
Last active November 25, 2021 16:21
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 TheRolfFR/9e5056626063eb4cb032ea21c845f144 to your computer and use it in GitHub Desktop.
Save TheRolfFR/9e5056626063eb4cb032ea21c845f144 to your computer and use it in GitHub Desktop.
Resolves promise after certain period of time in ms
/**
* Resolves promise after certain period of time in ms
* @author TheRolf
* @param {Number} timeout delay in ms
*/
const TimeoutPromise = function(timeout) {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, timeout);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment