promise-until-tired
v1.0.1
Published
[![semantic-release](https://img.shields.io/badge/semantic-release-e10079.svg?logo=semantic-release)](https://github.com/semantic-release/semantic-release) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https
Downloads
5
Readme
Promise until tired
Too long unresolved promise is tired and I gonna give up.
This is the promise with timeout.
Installation
yarn add promise-until-tired
Usage
import newPromiseUntilTired, { TiredFromWaitingPromiseResolveTooLongError } from 'promise-until-tired'
try {
const value = await newPromiseUntilTired((resolve, reject) => {
// logic
}, timeout)
} catch (error) {
if (error instanceof TiredFromWaitingPromiseResolveTooLongError) {
// handle timeout logic
} else {
// handle other reject logic
}
}