作者:阿凯宜_ | 来源:互联网 | 2023-09-18 23:07
WeallowuserstowritecodewhichsometimescallsjQuery.ready(function(){..})multipletimes.Its
We allow users to write code which sometimes calls jQuery.ready(function(){..})
multiple times. It seems like the first function call that throws an error prevents execution of the rest of the functions.
我们允许用户编写有时多次调用jQuery.ready(function(){..})的代码。看起来第一个抛出错误的函数调用会阻止执行其余的函数。
There was a discussion about this here with the solution wrapped jQuery.ready()
in a delegate instead of wrapping the anonymous function parameter passed to jQuery.ready(..)
.
这里有一个关于这个的讨论,解决方案在委托中包装jQuery.ready()而不是包装传递给jQuery.ready(..)的匿名函数参数。
How can I override jQuery.ready(fn)
and wrap the passed-in function parameter in a delegate which wraps it in try/catch and the passes to jQuery.ready(delegate)
?
我怎样才能覆盖jQuery.ready(fn)并将传入的函数参数包装在一个委托中,该委托将它包装在try / catch中并传递给jQuery.ready(委托)?
Here is an example:
这是一个例子:
What can I do to make code in run regardless of errors in ?
无论错误是什么,我该怎么做才能使代码运行?
3 个解决方案