How to update a 2MB JSON file using JavaScript?
I use phonegap to develop an Android application. Now, I need retrieve data from a JSON file and then update data back into this JSON file.
It shows me that the "JavaScript execution exceeded timeout"
How to update a 2MB JSON file using JavaScript?
I use phonegap to develop an Android application. Now, I need retrieve data from a JSON file and then update data back into this JSON file.
It shows me that the "JavaScript execution exceeded timeout"
Most JavaScript engines have an execution limit, meaning that they will throw an error when your code runs for longer than x seconds. In most browsers, this is just 5 or 10 seconds. Have a look at this answer on SO for more information.
Three solutions come to mind:
setInterval or setTimeout to call the code in iterations.