@jswork/next-cancelable-fetch
v1.0.0
Published
Cancelable fetch for next.
Downloads
2
Maintainers
Readme
next-cancelable-fetch
Cancelable fetch for next.
installation
npm install -S @jswork/next-cancelable-fetch
usage
import '@jswork/next-cancelable-fetch';
const fetchResource = nx
.cancelableFetch('https://api.github.com/users/afeiship', { cancelable: true })
.then(res=>res.json())
.then((res) => {
console.log('response:', res.body);
})
.catch((err) => {
console.log(err);
});
// abort
fetchResource.cancel();
license
Code released under the MIT license.