Skip to content

oddoye-david/timedout-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timedout Promise

Utility function to set a timeout in milliseconds for promises.

Install

> yarn add timedout-promise

Usage

const timedoutPromise = require('timedout-promise');

timedoutPromise(1000, fetch('https://foo.bar/fiz'))
  .then((data) => console.log(`${data.length} loaded before 1000ms`))
  .catch(() => console.log('Timed out in 1000ms'))

Tests

> yarn test

About

Timeout your promises

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published