New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

abortcontroller.js
(function(self) {
'use strict';
if (self.AbortController) {
return;
}
class AbortController {

@@ -5,0 +9,0 @@ constructor() {

2

package.json
{
"name": "abortcontroller-polyfill",
"version": "1.0.1",
"version": "1.0.2",
"description": "Browser polyfill for the AbortController DOM API (stub that calls catch, doesn't actually abort request).",

@@ -5,0 +5,0 @@ "main": "abortcontroller.js",

# AbortController "polyfill"
Minimal stubs so that the AbortController API for terminating ```fetch()``` requests can be used in
browsers that doesn't yet implement it. This "polyfill" doesn't actually close the connection when
the request is aborted, but it calls ```.catch()``` with ```err.name == 'AbortError'``` instead of
```.then()```.
Minimal stubs so that the AbortController DOM API for terminating ```fetch()``` requests can be used
in browsers that doesn't yet implement it. This "polyfill" doesn't actually close the connection
when the request is aborted, but it calls ```.catch()``` with ```err.name == 'AbortError'``` instead
of ```.then()```.
```js
const controller = new AbortController();
const signal = controller.signal;
fetch('/some/url', {signal}).then(res => res.json()).then(data => {
// do something with "data"
}).catch(err => {
if (err.name == 'AbortError') {
return;
}
});
const controller = new AbortController();
const signal = controller.signal;
fetch('/some/url', {signal}).then(res => res.json()).then(data => {
// do something with "data"
}).catch(err => {
if (err.name == 'AbortError') {
return;
}
});
```

@@ -29,3 +29,3 @@

If you're using webpack or similar, import it early in your client entrypoint .js file using
```require('abortcontroller-polyfill')``` or ```import 'abortcontroller-polyfill'```.
```import 'abortcontroller-polyfill'``` or ```require('abortcontroller-polyfill')```.

@@ -32,0 +32,0 @@

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