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

fl-backbone.nativeajax

v0.4.3

Published

A Backbone.Ajax function powered by native XHR methods

Downloads

6

Readme

Fork of Backbone.NativeAjax that doesn't consider 404s errors

Backbone.NativeAjax

A drop-in replacement for Backbone.Ajax that uses only native XMLHttpRequest methods for sync. It has no dependency on jQuery.

You might consider using the window.fetch pollyfill coupled with a simple plugin for Backbone instead of this project if you need better Promise or header support.

To Use:

Load Backbone.NativeAjax with your favorite module loader or add as a script tag after you have loaded Backbone in the page.

If loading with AMD or CommonJS you should set Backbone.ajax yourself:

// AMD
define(['backbone', 'nativeajax'], function(Backbone, ajax) {
  Backbone.ajax = ajax;
});

// CommonJS
var Backbone = require('backbone');
Backbone.ajax = require('backbone.nativeajax');

Features:

  • Accepts success and error callbacks
  • Set headers with a headers object
  • beforeSend

Requirements:

NativeAjax uses XMLHttpRequest which is supported in modern browsers. See the compatibility chart.

It also makes use of Function.prototype.bind which can be easily pollyfilled in older environments.

Set a Promise object on the global or on Backbone.ajax to return a promise.

Notes:

  • The ajax function accepts a success and error callbacks. To return a promise object, set a global Promise or Backbone.ajax.Promise.
  • Unlike jQuery, we don't automatically set the X-Requested-With header, so things like Rails' request.xhr? will break. If you need it, you can pass it in yourself.

Uses code from Exoskeleton. See that project for more information and other features.