Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extra-abort

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-abort

```sh npm install --save extra-abort # or yarn add extra-abort ```

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32
decreased by-90.99%
Maintainers
1
Weekly downloads
 
Created
Source

extra-abort

Install

npm install --save extra-abort
# or
yarn add extra-abort

API

AbortController, AbortSignal

Ponyfills of WHATWG AbortController and AbortSignal.

AbortError

class AbortError extends CustomError {}

It is not the real AbortError of fetch, but you can do err instance AbortError like it is, because it can recognizes other errors that match the pattern of AbortError.

timeoutSignal

function timeoutSignal(ms: number): AbortSignal

It will abort after ms milliseconds.

await fetch('http://example.com', { signal: timeoutSignal(5000) })

withAbortSignal

/**
 * @throws {AbortError} 
 */
function withAbortSignal<T>(signal: AbortSignal, fn: () => PromiseLike<T>): Promise<T>

If AbortSignal is aborted, the promise will be rejected with AbortError.

raceAbortSignals

function raceAbortSignals(abortSignals: Array<AbortSignal | Falsy>): AbortSignal

The Promise.race function for AbortSignal.

FAQs

Package last updated on 21 Oct 2022

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc