Socket
Socket
Sign inDemoInstall

abortable-timeout

Package Overview
Dependencies
4
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abortable-timeout

abortable timeout promise


Version published
Maintainers
1
Install size
124 kB
Created

Readme

Source

abortable-timeout

abortable timeout promise via abortsignals

Installation

npm i --save abortable-timeout

Usage

Supports both ESM and CommonJS
// esm
import timeout from 'abortable-timeout`
// commonjs
const timeout = require('abortable-timeout').default
Example
import timeout from 'abortable-timeout`

const controller = new AbortController()
const signal = controller.signal

try {
  await timeout(1000, signal)
} catch(err) {
  if (err.name === 'AbortError') {
    console.warn('aborted')
    return
  }
  throw err
}

controller.abort()

License

MIT

Keywords

FAQs

Last updated on 26 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc