实现代码如下:

//只能在firefox下运行
var test = {
name: "puterjam",
__noSuchMethod__: function(name, args){
alert(["Your call an error function [",name,"]. Arguments list: [",args,"]"].join(""));
}
}
test.hello();
test.helloWorld("china","shenzhen");

当我们执行了test对象里的某一个没有定义的方法,就会自动执行__noSuchMethod__方法,这样我们可以利用他来作一些容错和监控的工作。

以上就是【Mozilla 表达式 __noSuchMethod__】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论