[英]JavaScript update a 2MB JSON file
How to update a 2MB JSON file using JavaScript? 如何使用JavaScript更新2MB JSON文件?
I use phonegap to develop an Android application. 我使用phonegap开发Android应用程序。 Now, I need retrieve data from a JSON file and then update data back into this JSON file.
现在,我需要从JSON文件中检索数据,然后将数据更新回该JSON文件中。
It shows me that the " JavaScript execution exceeded timeout " 它向我显示“ JavaScript执行超出超时 ”
Most JavaScript engines have an execution limit, meaning that they will throw an error when your code runs for longer than x seconds. 大多数JavaScript引擎都有执行限制,这意味着当您的代码运行时间超过x秒时,它们将引发错误。 In most browsers, this is just 5 or 10 seconds.
在大多数浏览器中,这只是5或10秒。 Have a look at this answer on SO for more information.
有关更多信息,请参见SO上的此答案 。
Three solutions come to mind: 想到三个解决方案:
setInterval
or setTimeout
to call the code in iterations. setInterval
或setTimeout
在迭代中调用代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.