
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Asynchron js and json (ajaon). A tiny, fetch based http client for the web.
import ajaon from "ajaon"
// initialisation
let ajax = ajaon();
let req = ajax.post("apiCall", {ok: "ok"})
let getReq = ajax.get("resource")
req.then(console.log)
setTimeout(() => {
req.abort("Message")
}, 500)
req.fail(console.error) // 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.
The quick start example used no explicit initialisation options, however there are a couple of helpful customisations to be considered.
let apiUrl: string = "backend.myUrl.com" // Default: the baseUrl the website is renderd on
type SessKeyKey = {sessKeyKeyForStorage: string, sessKeyKeyForApi: string}
let sessKeyKey: string | SessKeyKey = "sess_key" // Default: "sessKey"
let storage: object = {} // Default: localStorage
let verbose: boolean = false // Default: true
let ajax = ajaon(apiUrl, sessKeyKey, storage, verbose)
apiUrl
: Your backend might be located on a different baseUrl
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 try https
on your first call; though if it fails ajaon will try http
next (without closing the outwards facing Promise
). The working protocol will be stored.sessKeyKey
: TODOAll feedback is appreciated. Create a pull request or write an issue.
FAQs
Asynchron js and json. A tiny, fetch based http client for the web.
The npm package ajaon receives a total of 13 weekly downloads. As such, ajaon popularity was classified as not popular.
We found that ajaon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.