Skip to content

Commit

Permalink
Add polyfills for older browser versions
Browse files Browse the repository at this point in the history
- Add AbortController polyfill for Safari 10 - 11 and Firefox 52 - 56
- Was going to add fetch polyfill but it is only missing from Safari 10.0. It is in Safari 10.1 and all
other browsers that need to be supported. All Safari before 10.1 is only
0.26% of all browsers usage. It is not possible to test Safari 10.0 on
Browserstack and the complexity and size cost of adding the polyfill
for this one minor version is large, so it was skipped it.

Including the one polyfill brings the size of the built package to 232K up
from 220K.
  • Loading branch information
rmeritz committed Jun 26, 2020
1 parent 99bb192 commit a24d8ec
Show file tree
Hide file tree
Showing 4 changed files with 668 additions and 197 deletions.
15 changes: 11 additions & 4 deletions lib/abort-controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
var AbortController = require('abort-controller');

// istanbul ignore next
module.exports = typeof window === 'undefined' ? AbortController : window.AbortController;
// istanbul ignore file
if (typeof window === 'undefined') {
module.exports = require('abort-controller');
} else {
if ('signal' in new Request('')) {
module.exports = window.AbortController;
} else {
var polyfill = require('abortcontroller-polyfill/dist/cjs-ponyfill');
module.exports = polyfill.AbortController;
}
}
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.4.0",
"es6-promise": "4.2.8",
"lodash": "4.17.15",
"node-fetch": "^2.6.0"
Expand Down
Loading

0 comments on commit a24d8ec

Please sign in to comment.