@anio-js-foundation/run-fn-with-timeout
v2.0.0
Published
Run a function with a timeout.
Downloads
4
Readme
@anio-js-foundation/run-fn-with-timeout
Run a function with a timeout.
import runFnWithTimeout from "@anio-js-foundation/run-fn-with-timeout"
function myFunction() {
return new Promise(resolve => {
setTimeout(resolve, 500, "hi")
})
}
const result = await runFnWithTimeout(myFunction, 100)
// prints { value: null, timeout: true }
console.log(result)