Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nafeu/0fd583913b110cc2621d14843ffa500d to your computer and use it in GitHub Desktop.
Save nafeu/0fd583913b110cc2621d14843ffa500d to your computer and use it in GitHub Desktop.
function delay(delayedFunction, time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
try {
resolve(delayedFunction());
} catch (error) {
reject(error.message);
}
}, time);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment