Hi Craig,
This can happen ;)
a)
Most modern browsers have a built in "feature" that warns you if a js
programm goes wild [1]. eg: FF automatically stopps "long running
scripts" with a message. May be you disabled this behaviour at your
browser? If so, you should enable it again.
b)
Some time ago, I did find some nice articles, about optimizing loop
handling in the browser [2]. Especially the blog posts "part 1"[3] and
"part 4"[4] may be interesting for you.
====
c)
I'd try this mechanism first.
With TW, the DOM handling (as described in part 4) can be a reason,
why your loops are "slow". If something changes the TW layout. Eg: if
you programmatically create a new tiddler. The TW core needs to update
the right sidebar ..., which is "slow", if it needs to be done very
often. In TW there are 3 functions to temporary stop this browser
layout redraw.
store.suspendNotifications();
// your loop goes here!
store.resumeNotifications();
store.notifyAll();
see
tiddlywiki.org [5] for more info
====
d)
Using the search term >> non blocking loop javascript << with
google, It did point me to a little library called "Clumpy" [6]
I had a short look, and it is the wrapper function you requested :)
You should start with the "for_loop" [7].
The library contains functions to create user feedback. eg: 10% -
20% .... 100% done!
Stopping, starting a loop is possible too. So this would be worth a
try.
====
c) and d) may also work, with fET. Note: may work.
hope this helps
-mario
[1]
http://www.nczonline.net/blog/2009/01/05/what-determines-that-a-script-is-long-running/
[2]
http://www.nczonline.net/blog/2010/02/09/announcing-high-performance-javascript/
[3] "part 1"
http://www.nczonline.net/blog/2009/01/13/speed-up-your-javascript-part-1/
[4] "part 4"
http://www.nczonline.net/blog/2009/02/03/speed-up-your-javascript-part-4/
[5]
http://tiddlywiki.org/#TiddlyWiki.prototype.notifyAll%20TiddlyWiki.prototype.suspendNotifications%20TiddlyWiki.prototype.resumeNotifications
[6]
http://www.tumuski.com/code/clumpy/overview/
[7]
http://www.tumuski.com/code/clumpy/reference/#for_loop