Package Exports
- @jswork/next-fetch-with-cancelable
- @jswork/next-fetch-with-cancelable/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jswork/next-fetch-with-cancelable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
next-fetch-with-cancelable
Cancelable fetch middleware for next.
installation
npm install -S @jswork/next-fetch-with-cancelableusage
import '@jswork/next-fetch-with-cancelable';
const cancelableFetch = nx.fetchWithCancelable(fetch);
const fetchResource = cancelableFetch('https://api.github.com/users/afeiship', { cancelable: true })
.then(res=>res.json())
.then((res) => {
console.log('response:', res);
})
.catch((err) => {
console.log(err);
});
// abort
fetchResource.cancel();license
Code released under the MIT license.