2

我在我的 JQM 应用程序中添加了一些异常处理,但在页面转换时遇到了问题。

简而言之,我正在这样做:

window.onerror = function myErrorHandler(errorMsg, url, lineNumber) {
   // Crap, something bad happened somewhere.  
   // Tell the user about it
   // Report it to TestFlight
   // Look at the variables in memory and try to determine how to gracefully recover.
}

总的来说,它运行良好——我通常可以将用户返回到主菜单或另一个“安全”恢复点,而不是让应用程序变成一块石头。

问题是这样的:如果在页面初始化期间发生异常,则 JQM 的“isPageTransitioning”标志保留为 TRUE。因此,它将不再接受 $.mobile.changePage() 调用。

JQM 中有一个名为 releasePageTransitionLock() 的函数可以解决该问题。然而,它并没有公开曝光。

我通过添加这个方法破解了 JQM:

$.mobile.releasePageTransitionLock = function()
{
    releasePageTransitionLock();
}

完美运行 - 但我不想破解我的 JQM 文件。

在 JQM 的受保护环境中是否有另一种合理的方式来访问 releasePageTransitionLock() ?

4

0 回答 0