1.0.1 • Published 6 years ago

timelimit v1.0.1

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

timelimit

NPM version Downloads Dependency status Dev Dependency status

Reject promises on timeout.

Installation

npm install --save timelimit

Usage

Basic usage:

import timelimit from 'timelimit'

const req = timelimit(
  fetch('https://example.com'),
  10000, // 10 seconds
  {
    rejectOnTimeout: true, // default is true
    errorMessage: 'timeout', // timeout error message (thrown if rejectOnTimeout is true)
  },
)