Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/afeiship/next-ajax-promise

Promise able for next ajax.
https://github.com/afeiship/next-ajax-promise

abort ajax destroy next promise

Last synced: 15 days ago
JSON representation

Promise able for next ajax.

Awesome Lists containing this project

README

        

# next-ajax-promise
> Promise able for next ajax.

## installation
```bash
npm install -S afeiship/next-ajax-promise --registry=https://registry.npm.taobao.org
```

## apis
| api | params | description |
| ----- | ---------------------------------- | --------------------- |
| fetch | inMethod, inUrl, inData, inOptions | Send a request by XHR |

## usage
```js
import NxAjaxPromise from 'next-ajax-promise';

// code goes here:
const res = NxAjaxPromise.fetch('get', 'https://api.github.com/users/afeiship', null,{ cancelable: true }).then(
(response) => {
console.log('response:->', response);
}
);

// cancel:
res.destroy();
```