1.0.0 • Published 5 years ago
@jswork/next-cancelable-fetch v1.0.0
next-cancelable-fetch
Cancelable fetch for next.
installation
npm install -S @jswork/next-cancelable-fetchusage
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.
1.0.0
5 years ago