npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jcall

v1.1.1

Published

Ajax library that ease sending asynchronous calls to your backend server

Readme

Jcall.js

Better results requires a beatifull seamless code design that both helps ease the workflow, and keep it organized. Jcalls offers all of that beside a plenty of other functionalities and features hidden midway ;).

yeap that's me! @yousef_neji

How to?

Importing..

// commonjs
var jcall = require('jcall');

// ESM
import Jcall from "jcall";

A simple example to send a simple request to create a user

let data = {
    username: "your_name",
    password: "Es4e5_*Es**45",
    email: "[email protected]",
    age: 23
}

// by default POST
jcall("/user/add")
    .launch(data)
    .then((res)=>{
        // structure of `res`
        // res = {
        // result : (data-sent-back-parsed),
        // response: (pure-response-object from either xmlHttpRequest or fetch)
        // headers: (Headers sent back with the request)
        // contentType: self-explainatory
        // }

        // supposing in nodejs: res.json({ success: true, action: "user-added", user})
        if(res.result.success){ 
            displayUser(res.result.user);
        }
    })
    .catch(e=>{
        console.error(e);
    })

Using Different Methods

jcall("GET:match/score") // get request
jcall("PATCH:match/data") // patch request
jcall("DELETE:user/record") // delete request
jcall("PUT:user/login") // update request
...

Manipulating headers

jcall("match/end")
// setting some headers
.setHeaders({
    accept: "application/json", // "application/xml" "text/html" ...
    cache: true,
    cookie: "some-cookies", 
    lang: "en",
    // ....
}).launch ...

CSRF(Cross-Site Request Forgery tokens)

For handling csrf tokenization the library offers an attribute csrf that ease defending this attack!

// on top of your scripte
var csrfToken = eye("meta[name='csrf-token']").attr("content");
jcall.csrf = csrfToken;
// from now on, will be send automatically with each request!

Authorization/login token

when authorizing a user, the usual flow consist of getting unique token from the backend and send it with each future call, so the server verify it's you!

// the `after` or `before` functions will sequencly execute
// after and before each request, can be used to dynamically 
// update the authorization token each time it get updated 
// server-side!
jcall.after = (res)=>{
    if(res.result.token)
        // the authorization attribute get 
        // send automatically in the headers 
        // with each request
        jcall.authorization = "Bearer " + res.result.token;
}

jcall.before = (request,data)=>{
    // do something to the data & the request
    let test = validate(data); // validation for example
    if(!test) return false; // will silently skip/stop the request returning `false` in .then() callback

}

// future request is authorized and well maintained

Preventer

the library offers a very good functionality called the preventer. it display a div element that prevent user from interacting with the window while a request is being sent!


// minimum preventer setup
// must have two functions `open` and `close` 
let untouchable = eye(".untouchable");
untouchable.open = function(){
    this.style.display = "inline-block";
}
untouchable.close = function(){
    this.style.display = "none";
}

jcall.preventer = untouchable;

// similarly you can just pass true
// and the library will auto create
// and use the preventer internally 
jcall.preventer = true;

Copyrights

Reserved under MIT license