fetch-pro
v0.0.4
Published
Elegant Fetch Lib with Power
Downloads
6
Readme
fetch-pro
Elegant Fetch Lib with Power
Usage
abortableFetch
import { abortableFetch } from 'fetch-pro';
async function demo() {
const client = abortableFetch(
{
method: 'post',
url: 'xxx'
},
{
data: {}
}
);
// abortable
client.abort();
// normal request
const result = await client.ready;
}
FetchPro
FetchType:
- Prevent
- CancelAndResend
import { FetchPro, FetchType } from 'fetch-pro';
async function demo() {
const client = new FetchPro(FetchType.CancelAndResend);
client.fetch('url');
client.fetch(
{
method: 'get',
url: 'xxx'
},
{}
);
const result = await client.ready;
// cancel manually
client.abort();
}
LICENSE
Apache-2.0