I have an object with callback-method which I should extend.
The object is elementHandle and method onCheckURLDone(result, data) is called internally somewhere. I need to execute some extended code and call back original function code.
I tried something like this:
var cachedCallback = elementHandle.onCheckURLDone;
elementHandle.onCheckURLDone = (function(result, data){
console.log("Some extended code...");
return function(result, data) {
return cachedCallback.apply(elementHandle, arguments);
}
});
But original code is not called here. What's wrong?
return function()...line and the close brace corresponding to it?