Miscellaneous jquery utility plugins
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Contains miscellaneous utility plugins for use with jQuery


Provides the ability to invoke a callback when multiple ajax calls have all completed. This is useful if, for example, you need to get the response from several web services before continuing execution.


$.ajaxWait(function() {
  $.getJSON('http://www.example.com/items.json', function(data) {...});
  $.getJSON('http://www.example.com/groups.json', function(data) {...});
}, {success: dataLoaded, error: dataError});

function dataLoaded() {
  alert('All data loaded!');

function dataError() {
  alert('Data failed to load!');

To also wait until ajax calls that are made within individual ajax callbacks:

$.ajaxWait(function() {
  $.getJSON('http://www.example.com/items.json', function(data) {
    $.getJSON('http://www.example.com/groups.json', function(data) {...});
}, {success: dataLoaded, error: dataError, deep: true});


Adds a set of assertions for validating that data is specified correctly.


Asserting valid keys in a hash:

var keys = ['start', 'end'];

$.assert.validKeys({}, keys)                   // >> null
$.assert.validKeys({begin: 1, end: 10}, keys)  // >> Invalid option(s): begin

Assert required keys in a hash:

var keys = ['start', 'end'];

$.assert.requiredKeys({}, keys)                    // >> Required option(s) not specified: start, end
$.assert.requiredKeys({start: 1}, keys)            // >> Required option(s) not specified: end
$.assert.requiredKeys({start: 1, end: 10}, keys)   // >> null

Assert valid values in a hash / array:

var values = ['start', 'end'];

$.assert.validValues({}, values)                                 // >> null
$.assert.validValues({first: 'start', last: 'finish'}, values)   // >> Invalid value(s): finish
$.assert.validValues(['start', 'finish'], values)                // >> Invalid value(s): finish

Assert the validity of keys and the types of their values:

var examples = {
  start: 'number',                              // Validate as a number
  end: 'number'                                 // Validate as a number
  to: ['string', ['string']],                   // Validate as either a string or an array of strings
  context: {callback: 'function', '*': true},   // Validate as a hash without a strict set of keys allowed
  actions: [[{text: 'string', data: 'object'}]] // Validate as an array of hashes containing certain keys / types,

var template = {start: 'number', end: 'number'};
$.assert.validate({}, template)                    // >> null
$.assert.validate({begin: 1, end: 10}, template)   // >> Invalid option(s): begin
$.assert.validate({start: '1', end: 10}, template) // >> Invalid type(s): start (number)