Ajaon
Asynchron js and json (ajaon). A tiny, fetch based http client for the web.
Example
Quick start
// initialisationlet ajax = ; let req = ajaxlet getReq = ajax req
Abort Network Requests
req // Abort: Message
Abort, or a for any other reason failed network request, does not throw an Error
, rather it calls all explicitly attached fail callbacks.
In this case, the req
Promise would never be resolved.
Initialisation options
The quick start example used no explicit initialisation options, however there are a couple of helpful customisations to be considered.
apiUrl
: Your backend might be located on a differentbaseUrl
than your frontend. This could be injected in your build script for different environments (dev, uat, prod). Please note that when no protocol (http
/https
) is given, ajaon will tryhttps
on your first call; though if it fails ajaon will tryhttp
next (without closing the outwards facingPromise
). The working protocol will be stored.sessKeyKey
: TODO
Contribute
All feedback is appreciated. Create a pull request or write an issue.