1.0.0 • Published 3 years ago

@jswork/next-cancelable-fetch v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

next-cancelable-fetch

Cancelable fetch for next.

version license size download

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.