@jswork/next-cancelable-fetch

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i @jswork/next-cancelable-fetch

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

5.68 kB

Total Files

6

Last publish

Collaborators

  • afeiship