It's definitely "supported".(绝对是“受支持的”。)
It is your web page, you do whatever you want to with it.(这是您的网页,您可以使用它进行任何操作。)
I already did this to track analytics events without modifying a library but by sneaking into events.(我已经这样做,无需修改库而是通过潜入事件来跟踪分析事件。)
Use the proxy pattern:(使用代理模式:)
(function(proxied) {
window.alert = function() {
// do something here
return proxied.apply(this, arguments);
};
})(window.alert);
You can also bypass the call to the original function if you want (proxied)(如果需要,也可以绕过对原始函数的调用(代理))
More info here: JQuery Types #Proxy Pattern(更多信息在这里: jQuery类型#Proxy模式)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…