[Dojo-interest] accessing global variables inside a callback

hmg monstro_ventoinha at hotmail.com
Thu Aug 11 22:03:40 EDT 2011


1) Your problem is that you are ignoring the assynchronicity of the deferred
- callback setting the variable will only be set after the deferred triggers
but the alert happens before you give a chance for that to happen (the
deferred can only trigger when your code stops running, after that alert)

If you wait for the deferred to trigger you can check that the variable
should be set as expected.

2) addCallback is old-style deferreds. Are you sure you can't use ".then"
instead?

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/accessing-global-variables-inside-a-callback-tp3247915p3248025.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.


More information about the Dojo-interest mailing list