Fix load state error

This commit is contained in:
YNH Webdev
2013-09-28 09:44:39 +02:00
parent cb1a4825d2
commit 1100328fee
16 changed files with 47 additions and 30 deletions

View File

@@ -31,10 +31,12 @@ Mini =
{
render:template(t)
}
loaded = {}
lazy_load = (requirements,fn,that)->
if not that?
that = window
return ()->
a = arguments
if not args?
args = []
counter = requirements.length + 1
@@ -42,10 +44,15 @@ lazy_load = (requirements,fn,that)->
done = ()->
counter = counter - 1
if counter == 0
fn.apply(that,arguments)
fn.apply(that,a)
return
for r in requirements
$.cachedScript(r).done(done)
if loaded[r]?
done()
else
$.cachedScript(r).done ()->
done()
loaded[r] = true
done()
build_control = (control_name, state, control)->