Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sync apply function
syncApply ({timeout, fn, args = [], scope = this}) {
return new Promise((resolve, reject) => {
try {
setTimeout(() => {
resolve(fn.apply(scope, args))
}, timeout)
} catch (err) {
reject(err)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.