Skip to content

Commit

Permalink
fix: use native abort controller if available (#5)
Browse files Browse the repository at this point in the history
Some environments like Electron's Renderer process have native browser
APIs available but don't respect the `browser` field in `package.json`.

You also don't always want to use 100% browser or 100% node APIs depending
on your application, so don't make the user choose all or nothing.

Here we switch out `abort-controller` for `native-abort-controller`
which will return the native abort controller if it's available, or the
`abort-controller` polyfill if it is not.
  • Loading branch information
achingbrain authored Aug 31, 2020
1 parent faf310e commit db1fd14
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 136 deletions.
4 changes: 0 additions & 4 deletions abort-controller.browser.js

This file was deleted.

9 changes: 0 additions & 9 deletions abort-controller.js

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const AbortController = require('./abort-controller')
const AbortController = require('native-abort-controller')

/**
* Takes an array of AbortSignals and returns a single signal.
Expand Down
198 changes: 81 additions & 117 deletions package-lock.json

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

Loading

0 comments on commit db1fd14

Please sign in to comment.