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

native-abort-controller

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

native-abort-controller

Returns native AbortController/AbortSignal if available or the abort-controller module if not

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

native-abort-controller

Returns native AbortController/AbortSignal if available or the abort-controller module if not

A drop-in replacement for the abort-controller module that returns the native AbortController if available or the polyfill if not.

Why?

Some environments such as the Electron Renderer process straddle the node/browser divide with features from both APIs available. In these cases the webpack approach of always using the browser field in your package.json to override requires is too heavy-handed as sometimes you want to use the node version of an API.

Instead we can check for the availability of a given API and return it, rather than the node-polyfill for that API.

This module may become unecessary if mysticatea/abort-controller#24 is resolved.

Install

You must install a version of abort-controller alongside this module to be used if a native implementation is not available.

$ npm install --save native-abort-controller abort-controller

Usage

import AbortController from 'native-abort-controller'

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

signal.addEventListener('abort', () => {
    console.log('aborted!')
})

controller.abort()

FAQs

Package last updated on 28 Aug 2020

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