1 /**
  2  * jQuery Callback
  3  * @author Alberto Bottarini <alberto.bottarini@gmail.com
  4  * @version 1.1
  5  * @homepage http://code.google.com/p/jquerycallback
  6  *
  7  * jQuery-callback permits jQuery developer to have a real control to their callback functions. 
  8  * With this plugin you can set custom parameters and custom scope to each callback defined in your script. 
  9  */
 10  
 11 (function(jq) {
 12 	var asArray = function(a) {
 13 		return Array.prototype.slice.call(a,0);
 14 	}
 15 	jq.delegate = function(func, scope, params, overwriteDefault) {
 16 		if(!$.isArray(params)) params = [params];
 17 		return function() {
 18 			if(!overwriteDefault) func.apply(scope, asArray(arguments).concat(params));
 19 			else func.apply(scope, args);
 20 		}
 21 	}	
 22 	jq.callback = function(func, params, overwriteDefault) {
 23 		return jq.delegate(func, this, params, overwriteDefault);
 24 	}
 25 })(jQuery);
 26