Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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