documentcloud/underscore — Issue #450: _.defer
Author: mcoolin
Created: 2012-01-29 17:39:00+00:00
State: open

I am using defer in my application and generally it works like a charm. However I have noticed the IE/FIrefox work as expected with the calls executing when the current call stack clears.

But then chrome does not seem to operate in the same manner and I get an aw snap window, it appears that chrome sees the deferred item as part of the same set of execution and triggers a long running script error.

My code works fine with value up to about 900 then results begin to vary.

My coffeescript code looks like:
for x in [1..2000]
modl = {}
modl.item=x
WDX.templates().insertTemplate '#container_24', 'myTemplate', modl

Is there a better solution than defer or do I just need to keep my limits to 500-800 records?

Thanks in advance