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 🙏

© 2024 – Pkg Stats / Ryan Hefner

aja

v0.4.1

Published

Asynchronous JavaScript And JavaScript/JSON(P) : Ajax without XML

Downloads

502

Readme

aja.js Build Status NPM version Built with Grunt

Ajax without XML : Asynchronous Javascript and JavaScript/JSON(P)

Npm Downloads

Basic Sample

Request JSON data

  aja()
    .url('/api/data.json')
    .on('success', function(data){
        //data is a JavaScript object
    })
    .go();

Load html into an element

  aja()
    .url('/views/page.html')
    .into('.container')
    .go();

More options using the fluent api, terrific REST client.

  aja()
    .method('GET')
    .url('/api/customer')
    .timeout(2500)
    .data({firstname: 'John Romuald'})
    .on('200', function(response){
        //well done
    })
    .on('timeout', functon(){
        // uh oh... Request ended. Do something fancy here, don't let your user wait forever!
    })
    .go();

  aja()
    .method('PUT')
    .url('/api/customer')
    .cache(false)
    .body({id : 12, firstname: 'John Romuald', job : 'linguist'})
    .on('200', function(response){
        //well done
    })
    .on('40*', function(response){
        //something is definitely wrong
    })
    .on('500', function(response){
        //oh crap
    })
    .go();

JSONP

  aja()
    .url('http://otherdomain.com/api/remoteScript')
    .type('jsonp')
    .padding('someGlobalFunction')
    .on('success', function(data){
        //Fuk cross origin policy
    })
    .go();

Raw script loading

    aja()
        .url('http://platform.twitter.com/widgets.js')
        .type('script')
        .on('success', function(){
            window.twttr.widgets.load();
        })
        .go();

Development

Setup

You need grunt >= 0.4 as well as node and npm installed and running on your system.

git clone https://github.com/krampstudio/aja.js.git
cd aja.js
npm install

Tests

Run the tests:

grunt test

Development

The dev of this library is based on TDD principle. So, dev means write tests. Run the developent server :

grunt devtest

So tests run once something is modified and you can access it also at http://localhost:9901/test

Contributing

Contributions (issue reporting, bug fixes, feedback, typos, gimie a tip, etc.) are really welcomed! This library is developed using the TDD principles, so I accept pull request only if they come with the according unit/integration test.

I'd love if somebody can create a nice logo for aja.js...

History

  • 0.1.0 : initial release
  • 0.2.0 : added support of new HTTP methods (trace, patch and connect)
    • 0.2.1 : Fix missing main prop in package.json
  • 0.3.0 : support new request type : script
    • 0.3.1 : Fix issue #4 and cache management
    • 0.3.2 : Fix issue #7
    • 0.3.3 : Fix issue #10 and #11
    • 0.3.4 : reminify
  • 0.4.0 : added timeout
    • 0.4.1 : Merge PR #16

License

Copyright (c) 2014 Bertrand Chevrier <"chevrier_bertrand gmail_com".replace(/\s/, '@').replace(/_/g, '.')> Licensed under the MIT license.