не совсем
window.callEvent = function(func, callback){
return function(){
var args = Array.prototype.slice.call(arguments);
var result;
try {
result = func.apply(this, arguments);
} catch (e) {
callback(e, args, this);
throw e;
}
callback(result, args, this);
return result;
}
}