1.0.1 • Published 6 years ago

proto-timeout v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

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): Then install function
  • timeout: The added timeout function, requires a promise variable in scope
  • uninstall: Undoes the actions of the install function