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.1.2 to 1.1.3

1

dist/abortcontroller.js

@@ -82,2 +82,3 @@ 'use strict';

_this2.aborted = false;
_this2.onabort = null;
return _this2;

@@ -84,0 +85,0 @@ }

@@ -82,2 +82,3 @@ 'use strict';

_this2.aborted = false;
_this2.onabort = null;
return _this2;

@@ -84,0 +85,0 @@ }

6

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

@@ -8,3 +8,4 @@ "main": "dist/browser-polyfill.js",

"build": "mkdir -p dist ; babel src/ --out-dir dist/ ; cat dist/abortcontroller.js dist/patch-fetch.js > dist/browser-polyfill.js",
"test": "SELENIUM_BROWSER=chrome E2E_HEADLESS=1 ./scripts/wdio-suppress-exitcode",
"test": "npm-run-all test-headless eslint",
"test-headless": "SELENIUM_BROWSER=chrome E2E_HEADLESS=1 ./scripts/wdio-suppress-exitcode",
"test-chrome": "SELENIUM_BROWSER=chrome ./scripts/wdio-suppress-exitcode",

@@ -30,2 +31,3 @@ "test-firefox": "SELENIUM_BROWSER=firefox ./scripts/wdio-suppress-exitcode",

"eslint": "^4.13.1",
"npm-run-all": "^4.1.2",
"updtr": "^2.0.0",

@@ -32,0 +34,0 @@ "wdio-jasmine-framework": "^0.3.2",

@@ -1,7 +0,7 @@

# AbortController "polyfill"
# AbortController polyfill for abortable fetch()
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()```.
when the request is aborted, but it will call ```.catch()``` with ```err.name == 'AbortError'```
instead of ```.then()```.

@@ -28,11 +28,21 @@ ```js

If you're using webpack or similar, import it early in your client entrypoint .js file using
```import 'abortcontroller-polyfill'``` or ```require('abortcontroller-polyfill')```.
If you're using webpack or similar, you then import it early in your client entrypoint .js file using
# How to use in 'create-react-app'
```js
import 'abortcontroller-polyfill'
```
create-react-app enforces the no-undef eslint rule at compile time so you might
run into an error like:
or
```js
require('abortcontroller-polyfill')
```
## Using it along with 'create-react-app'
create-react-app enforces the no-undef eslint rule at compile time so if your
version of eslint does not list ```AbortController``` etc as a known global for
the ```browser``` environment, then you might run into an compile error like:
```
'AbortController' is not defined no-undef

@@ -54,8 +64,4 @@ ```

# See also
* [PR for fetch specification](https://github.com/whatwg/fetch/pull/523)
# License
MIT

@@ -50,2 +50,3 @@ (function(self) {

this.aborted = false;
this.onabort = null;
}

@@ -52,0 +53,0 @@ toString() {

@@ -9,2 +9,17 @@ const chalk = require('chalk');

it('AbortSignal constructor', () => {
browser.url(TESTPAGE_URL);
const res = browser.executeAsync(async (done) => {
const signal = new AbortSignal();
if (signal.aborted !== false) {
done('FAIL');
}
if (signal.onabort !== null) {
done('FAIL');
}
done('PASS');
});
expect(res.value).toBe('PASS');
});
it('Request is patched', () => {

@@ -11,0 +26,0 @@ browser.url(TESTPAGE_URL);

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