I’m looking for override event and still preform it’s actions.
Meaning something like this:
var oldOnError = window.onerror;
window.onerror = function(msg, url, line) {
oldOnError();
};
Now this will get executed however, onerror event could accept several arguments and I don’t and can’t know which are there.
So :
- Is there a simple solution for this?
- If not, how can i know what parameters
oldOnErrorexpecting to get?
Why not use addEventListener()
That way you do not override existing event listeners.
The other thing to note is that even though you specify 3 arguments your function is passed an event object when called. So really your function should be defined as follows.
Have a look at the MDN site here for more information