# ajax-camp

> A ajax library of javascript.

Latest version **0.2.0** (published 2017-12-29) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ajax-camp
pnpm add ajax-camp
yarn add ajax-camp
bun add ajax-camp
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-12-29 |
| First published | 2017-12-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ansenhuang |
| Maintainers | ansenhuang |
| Keywords | ajax, javascript |

## Links

- npm: https://www.npmjs.com/package/ajax-camp
- npm.io page: https://npm.io/package/ajax-camp

## Dependencies (1)

- [util-factory](https://npm.io/package/util-factory.md) ^0.2.0

## Recent versions

- 0.2.0 (latest) — 2017-12-29
- 0.1.0 — 2017-12-28
- 0.0.1 — 2017-12-26

## README

# ajax-camp

A ajax library of javascript.

# API Reference

## ajax

| 参数 | 描述    | 类型    | 值域       | 默认值   | 是否必须 |
|-----|---------|--------|-------------| ----- | ------- |
| url | 请求地址 | String | 无       | 无    | 是      |
| method | 请求类型 | String | get, post, jsonp | get | 否 |
| timeout | 请求超时时间，默认不会超时 | Number | 无     | 0    | 否     |
| credentials | 跨域请求是否可以发送凭据（例如：Cookie） | Boolean | 无       | false   | 否     |
| headers | 请求头部 | Object | 无       | {'Accept': '*/*', 'Content-Type': 'application/x-www-form-urlencoded'}    | 否      |
| params | get请求参数 | Object | 无       | {}    | 否      |
| body | post请求参数，支持FormData | Object | 无       | null    | 否      |
| progress | 请求实时进度 | Function | 无 | 无 | null | 否 |

### Response

| 参数 | 描述    | 类型    |
|-----|---------|--------|
| status | 状态码 | Number |
| statusText | 状态描述 | String |
| result | 返回数据 | Any |

## AjaxCamp (api)

**example**

```js
const api = {
  getRepoIssues: {
    url: '/issues',
    method: 'jsonp',
    params: {
      sort: {
        type: String,
        default: 'updated' // created, updated, comments
      },
      page: {
        type: [Number, String],
        required: true
      },
      per_page: {
        type: [Number, String],
        default: 10
      }
    }
  }
}

const camp = new AjaxCamp(api)

// usage
camp.getApi('getRepoIssues', {
  sort: 'updated',
  page: 1,
  per_page: 10
}).then(res => {
  // do something
})
```

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