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

tcb-missile

v0.1.1

Published

A tiny AJAX library.

Downloads

4

Readme

(AJAX) Missile

Tiny AJAX library that aims to be VERY similar to jQuery's $.ajax(settings) method.

Installation

npm install git://github.com/thecodebureau/missile.git

Usage

Works exactly like jQuery's $.ajax(settingsObject) function.

Missile({
  method: 'POST',
  url: '/api/objects',
  // one can also use dataType, like jQuery
  responseType: 'json',
  contentType: 'application/json',
  data: JSON.stringify({ key: 'value' }),
  success: function(response, textStatus, xhr) {
    console.log('success');
  },
  error: function(xhr, textStatus, errorThrown) {
    console.log('error');
  }
});

Set Defaults

To set defaults for any option to be used anytime it is not supplied (supports both Missile property names, or jQuery property names. See below.):

Missile.setDefaults({
  contentType: 'application/json;charset=UTF-8'
});

Compatability With & Differences to jQuery

Besides returning native XHR objects instead of jqXHR objects and dropping pre IE8 support, Missile aims to be 100% compatible with jQuery's $.ajax() function.

Renamed Options

TCB thinks some setting OPTIONS Are not named aptly considering property names of native XHR objects. Thus, the following have been renamed. To retain afore mentioned jQuery compatibility all jQuery property's are also still valid.

  • accepts -> accept
  • dataType -> responseType
  • type -> method

Implemented functionality

| property | implemented | differences to jQuery | |-----------|-------------|----------------------------| | accepts | Yes | Also available as accept.| | async | No | N/A | | beforeSend | No | N/A | | cache | No | N/A | | complete | Yes | None | | contents | No | N/A | | contentType | Yes | None | | context | No | N/A | | converters | No | N/A | | crossDomain | No | N/A | | data | Yes | Only accept a string (must be set according to contentType) or an object if contentType is 'application/json'. | | dataFilter | No | N/A | | dataType | Yes | Also available as responseType. Only accepts responseTypes accepted by the native XHR object. Which is 'arraybuffer', 'blob, 'document', 'json' and 'text'. | | error | Yes | Returns a native XHR object instead of a jqXHR object. And it returns whatever you asked for with responseType/dataType. IE, if you asked for JSON you will get an error OBJECT back, not a status text or anything crazy like that. | | global | No | N/A | | headers | Yes | Not sure of jQuery's default behaviour, but Missile overrites any properties that might have been set with accept[s] or similar. | | ifModified | No | N/A | | isLocal | No | N/A | | jsonp | No | N/A | | jsonpCallback | No | N/A | | mimeType | No | N/A | | password | No | N/A | | processData | Yes | The processing can currently only create JSON string, not URL encoded. | | scriptCharset | No | N/A | | statusCode | No | N/A | | success | Yes | It is passed a native XHR object instead of a jqXHR object. | | timeout | No | N/A | | traditional | No | N/A | | type | Yes | Also available as method. | | url | Yes | None | | username | No | N/A | | xhr | Yes | In the default mode, it does not create ActiveXObject objects, only XMLHttpRequest objects | | xhrFields | No | N/A |