Write in the Chrome Inspector / Firefox Developer Tools:
debuggingMethod = window.debugginMethod;
window.debuggingMethod = function (...arguments) {
console.trace(arguments); // console.log
debuggingMethod.apply(window, arguments);
}
- Use
function
better thanarrow function
to avoid undesired scope changes.
Example
replaceState = window.history.replaceState;
window.history.replaceState = function (...arguments) {
console.trace(arguments);
replaceState.apply(window.history, arguments);
}