afeiship / next-ajax-promise

Promise able for next ajax.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

next-ajax-promise

Promise able for next ajax.

installation

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

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();

About

Promise able for next ajax.

License:MIT License


Languages

Language:JavaScript 71.7%Language:HTML 28.3%