ajaxo

0.0.3 • Public • Published

Ajaxo - A Simple Ajax Wrapper (WIP)

Ajaxo is a promise-based Ajax wrapper with simple configurations, built with modern JavaScript technology. More docs and examples is coming.

// api.js
import {APIBuilder} from 'ajaxo';
 
var definitions = {
    report: {
        url: '/report/<%= id %>',
        type: 'POST',
    }
};
export var API = APIBuilder(definitions);
 
// request-actions.js
API.report()
    .resolveWith({ id: 1 })
    .post()
    .then(response => {
        doSomethingWith(response);
    })
    .catch(xhr => {
        ...
    });

Import dist lib or ES2015 version

If you are willing to use pre-compiled ES2015 src directly, import from ajaxo/lib instead like:

import {APIBuilder} from 'ajaxo/lib/api';

Package Sidebar

Install

npm i ajaxo

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • sairion