(function($) {

var defaults = {
  slow: 500
};

$.whenSlow = function(promise, callback, context) {

  // whenSlow(promise, 'methodName', object);
  if ($.type(callback) === 'string' && $.type(context) === 'object') {
    callback = context[callback];
  }
  // whenSlow(promise, func)
  else if (!context) {
    context = this;
  }

  var timeout = setTimeout(function() {
    if (promise.state() === 'pending') {
      callback.call(context);
    }
  }, defaults.slow);

  promise.always(function() {
    clearTimeout(timeout);
  });

  return promise;

};

$.whenSlow.defaults = defaults;

})(jQuery);
//
// jQuery.whenSlow
// https://github.com/TheCloudlessSky/jquery-whenSlow
// 
// Copyright (c) 2013 Adrian Phinney
// Licensed under the MIT license.
//
(function($) {

var defaults = {
  slow: 500
};

$.whenSlow = function(promise, callback, context) {

  // whenSlow(promise, 'methodName', object);
  if ($.type(callback) === 'string' && $.type(context) === 'object') {
    callback = context[callback];
  }
  // whenSlow(promise, func)
  else if (!context) {
    context = this;
  }

  var timeout = setTimeout(function() {
    if (promise.state() === 'pending') {
      callback.call(context);
    }
  }, defaults.slow);

  promise.always(function() {
    clearTimeout(timeout);
  });

  return promise;

};

$.whenSlow.defaults = defaults;

})(jQuery);
Add the project url and license to the head.
Add the project url and license to the head.
