Home

ajx

npm version Downloads/month Build Status Dependency Status

Simple fetch library for me.

πŸ’Ώ Installation

Use npm.

$ npm install --save ajx

πŸ“– Usage

API reference is /docs.

const ajx = require("ajx")

async showExampleCom() {
    // Send a HTTP GET request.
    const html = await ajx.get("http://example.com/")
    console.log(html)
}

showExampleCom()

The requests are cancellable.

const ajx = require("ajx")

async showExampleCom(cancelToken) {
    const html = await ajx.get("http://example.com/", {cancelToken})
    console.log(html)
}

const ct = ajx.CancelToken.new()
showExampleCom(ct).catch(error => {
    if (ajx.isCancel(error)) {
        console.log("canceled:", error.message)
    } else {
        console.error("some errors:", error.message)
    }
})
ct.cancel("some reason")

πŸ“° Changelog

πŸ’ͺ Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.

Development Tools

  • npm test runs tests.
  • npm run docs opens the current documents by your default browser.
  • npm run update-docs generates documents from the current source code.
  • npm run watch runs tests and measures coverage when source code are changed.