Is there a better way than this to create a callback function for some random function ?
var showObj = function(obj,callback) {
return setTimeout(function () {
if(opts.centerObj == true) {
var cssProps = getProps(obj);
obj.css(cssProps).fadeIn( slow );
}
else {
obj.fadeIn( slow );
}
if(typeof callback == function ) {
callback.call(this);
}
}, 1500);
}
The callback function doesn t have any parameter when I utilize it, I only do like this:
showObj(obj,function(){
/* Some Callback Function */
});