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

abortcontroller-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abortcontroller-polyfill

Polyfill/ponyfill for the AbortController DOM API + optional patching of fetch (stub that calls catch, doesn't actually abort request).

  • 1.7.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1M
decreased by-10.87%
Maintainers
1
Weekly downloads
 
Created

What is abortcontroller-polyfill?

The abortcontroller-polyfill package provides a polyfill for the AbortController interface, which allows you to abort one or more Web requests as and when desired. This is particularly useful for canceling fetch requests in environments where the AbortController API is not natively supported, such as older browsers.

What are abortcontroller-polyfill's main functionalities?

Aborting a fetch request

This code demonstrates how to use abortcontroller-polyfill to abort a fetch request. An instance of AbortController is created, and its signal is passed to the fetch request. Calling `abort` on the controller instance will cancel the request.

const { AbortController } = require('abortcontroller-polyfill/dist/cjs-ponyfill');
let controller = new AbortController();
let signal = controller.signal;

fetch('https://example.com', { signal })
  .then(response => console.log(response))
  .catch(err => console.error(err));

// Abort the request
ccontroller.abort();

Other packages similar to abortcontroller-polyfill

FAQs

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