1.0.1 • Published 7 years ago
proto-timeout v1.0.1
by @DecentM
Adds a convenient timeout function to your promises
Usage
const install = require('proto-timeout')
install()
const get = () => new Promise((resolve, reject) => {
setTimeout(() => {
resolve('Hello, world!')
}, 100)
})
get()
.timeout(200)
.then((result) => {
console.log(result)
})Exported functions
(main): Theninstallfunctiontimeout: The addedtimeoutfunction, requires apromisevariable in scopeuninstall: Undoes the actions of theinstallfunction