iPhone的Javascript执行时间 [英] iPhone Javascript execution time

查看:95
本文介绍了iPhone的Javascript执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在苹果的文档它说,

JavaScript执行时间限定为10秒为每个顶级入口点。   如果超过10秒,你的脚本执行,iPhone上的Safari OS停止在随机位置执行脚本

JavaScript execution time is limited to 10 seconds for each top-level entry point. If your script executes for more than 10 seconds, Safari on iPhone OS stops executing the script at a random place

我打算有一些JavaScript每10秒左右,将做一个AJAX查询服务器和重写所需的页面的只是部分。这会不会有可能与设备上的这些限制呢?

I plan to have some Javascript run every 10 seconds or so that will do an AJAX query to the server and rewrite just the section of the page necessary. Will this be possible with these restrictions on the device?

推荐答案

是的,这是可能的,前提是你使用时调用每10秒,而不是忙等待10秒的回调实现它。换句话说,如果你使用的setInterval来实现这一点,那么你的罚款。

Yes, it is possible, provided that you implement it using a callback that is invoked every 10 seconds, rather than busy waiting for 10 seconds. In other words, if you use setInterval to achieve this, then you're fine.

这篇关于iPhone的Javascript执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆