I have repeatedly encountered problems in Internet Explorer. "This script has been running for too long, do you want to continue?" Messages I am wondering if anyone knows a clever way to trick the JS engine into being silent? Based on some search results, I found that the engine monitor claims that it could potentially be infinitely looped, so I thought that maybe I could add some logic to change the execution each time, to trick it, leaving it alone, but no luck. I also tried breaking the long cycle into several shorter ones, but that didn't help. In particular, the code currently causing the problems is the expansion of nodes in the tree structure. The code cycles through the current nodes and expands each. This is a trivial thing to write in Javascript,but I cannot resolve these timeout errors, so I think my only option is to request pre-expanded view data via AJAX. I am currently working in a DEV environment with a small (ish) dataset and I know that this will not fly in other environments. Has anyone been able to suppress these warnings?
A good way is to simulate threading execution using function calls setTimeout(). This requires dividing all your processing into smaller parts and queuing them one by one. Timeouts can be set very close to each other, but they will start one after another when each of them completes execution.
setTimeout()
How to calculate it using a series of events. Thus, a loop arises, dispatches an event, listens for event triggers, and executes the loop. etc..?
jQuery?
http://api.jquery.com/queue/
- ? , x , , .
- , - (, <span>).
<span>
setTimeout. , , , , setTimeout. , http://www.julienlecomte.net/blog/2007/10/28/ . , HTML5 WebWorkers. , . . Robertnyman.com/2010/03/25/using-html5-web-workers-to-have-background-computational-power/ , IE html5demos.com/
, - , . , , , , API- , , jQuery. , :
$.each(arr, function(value) { // do stuff });
:
for (var i = 0, l = arr.length; i < l; i++) { var value = arr[i]; // do stuff }
- - . "foo.bar", , .
, , , , , , , .
I managed to do this using prototypes of the Function # defer method, which essentially matches the setTimeout method. Thanks everyone!