You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

abortable-timeout

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abortable-timeout

abortable timeout promise


Version published
Maintainers
1
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

Package last updated on 26 Apr 2024

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc