noop function return value
hi,
wouldn't it be much better if the jquery noop function would return true, instead of nothing?
it would be useful if you've optional callbacks which can cancel a process.
for example:
-
$.noop = function() { return true; };
var test = {
doSomething: function(options) {
var options = $.extend({},this.defaults, options);
if(!options.myCallback()) {
//the callback wants to cancel the process
alert('no');
return false;
}
//the callback says it's ok to continue
alert('yes');
},
defaults: {
myCallback: $.noop
}
};
test.doSomething();
test.doSomething({myCallback: function() {
//check anything
return false;
}
});