I think extending the function is working correctly but I am not sure how to handle the parameters that are passed into the function, right now I get a x is undefined error.
Original function:
_adloadCallback = function(x, y) {
//
}
Extended function:
(function() {
_adLoadCallbackExtend =_adloadCallback();
_adloadCallback = function() {
console.log("Before");
_adLoadCallbackExtend.apply(this, arguments);
console.log("After");
}
})();
()in_adLoadCallbackExtend =_adloadCallback();. You want to set the variable to the function, not call it. Also, you should probably addvarthere.