apiz-browser-client
TypeScript icon, indicating that this package has built-in type declarations

7.0.2 • Public • Published

apiz-browser-client

apiz-browser-client implements the APIzClient interface for browser, based on tinyjx, so you can use options of tinyjx.

Usage

import { APIz } from 'apiz-ng';
import apizClient from 'apiz-browser-client';
 
const apiMeta = {
    getBook: {
        url: 'http://www.a.com'
    }
};
 
const apis = new APIz(apiMeta, {
    client: apizClient({
        beforeSend(xhr) {
            return false;
        },
        afterResponse(resData, status, xhr, url, reqData) {
            console.log(resData);
        },
        complete(resData, xhr, url, reqData) {
            console.log(resData);
        },
        retry: 3
    })
});
 
apis.getBook().then(({data, next}) => {
    console.log(data);
    next();
})

beforeRequest and afterResponse are hooks of tinyjx.

Dependents (1)

Package Sidebar

Install

npm i apiz-browser-client

Weekly Downloads

2

Version

7.0.2

License

MIT

Unpacked Size

50.2 kB

Total Files

12

Last publish

Collaborators

  • ta7sudan