# apiz-browser-client

> Browser client for apiz

Latest version **7.0.2** (published 2019-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install apiz-browser-client
pnpm add apiz-browser-client
yarn add apiz-browser-client
bun add apiz-browser-client
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 7.0.2 |
| Published | 2019-09-17 |
| First published | 2018-10-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 49 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ta7sudan |
| Maintainers | ta7sudan |
| Keywords | client, apiz, browser |

## Links

- npm: https://www.npmjs.com/package/apiz-browser-client
- Repository: https://github.com/ta7sudan/apiz-browser-client
- Homepage: https://github.com/ta7sudan/apiz-browser-client#readme
- Issues: https://github.com/ta7sudan/apiz-browser-client/issues
- npm.io page: https://npm.io/package/apiz-browser-client

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^1.9.3
- [tinyjx](https://npm.io/package/tinyjx.md) ^3.1.2

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 7.0.2 (latest) — 2019-09-17
- 7.0.1 — 2019-09-12
- 7.0.0 — 2019-08-19
- 6.0.1 — 2019-07-26
- 6.0.0 — 2019-07-26
- 5.0.0 — 2019-04-24
- 4.1.5 — 2019-03-22
- 4.1.4 — 2019-03-22
- 4.1.3 — 2019-03-19
- 4.1.2 — 2019-03-19
- 4.1.1 — 2019-03-18
- 4.1.0 — 2019-03-18
- 4.0.0 — 2019-02-05
- 2.0.1 — 2018-11-28
- 2.0.0 — 2018-11-28
- … 20 more at https://npm.io/package/apiz-browser-client/versions

## README

# apiz-browser-client
apiz-browser-client implements the `APIzClient` interface for browser, based on [tinyjx](https://github.com/ta7sudan/tinyjx), so you can use options of tinyjx.



## Usage

```javascript
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](https://github.com/ta7sudan/tinyjx).

---
_Source: https://npm.io/package/apiz-browser-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
