New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jcoreio/abortable

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jcoreio/abortable

memory-leak-proof function to wrap a promise to reject when a signal is aborted

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
798
increased by37.35%
Maintainers
0
Weekly downloads
 
Created
Source

@jcoreio/abortable

memory-leak-proof function to wrap a promise to reject when a signal is aborted

CircleCI Coverage Status semantic-release npm version

abortable(promise, signal)

Creates a promise that fulfills when the given promise fulfills, or rejects when the given signal is aborted, whichever comes first. If the signal is aborted, rejects with a DOMException with name: 'AbortError'.

Once the returned promise resolves or rejects, references to all promise and signal handlers will have been removed, so that it doesn't unexpectedly retain any memory.

import { abortable } from '@jcoreio/abortable'

const abortController = new AbortContorller()
const { signal } = abortController

const promise = abortable(new Promise((r) => setTimeout(r, 10000)), signal)

Keywords

FAQs

Package last updated on 03 Dec 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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc