Select to view content in your preferred language

Map events handling

755
3
05-27-2010 11:59 PM
RicardasVaitkus
New Contributor
Hi all.

I am bulding my application, and puting tools I need one by one. But now I have faced one problem with map events. As I add event handling functions in init function, some of them seems are not working properly. Now I can't make fire event onLayerAdd. I am testing it using line from reference: dojo.connect(map, "onLayerAdd", function() { console.log("Layer added"); });
Working only with onLoad events I have noticed it depends order (my guess is it helped), so may be there is some rules of how to make correct order of them.

If any one has an idea, please response.

Thanks in advance
Ricardas
0 Kudos
3 Replies
AdamPfister
Esri Contributor
can you post a more complete code sample of what you're trying to do?
0 Kudos
derekswingley1
Deactivated User
When are you running that dojo.connect statement?

I agree with Adam, posting your current code would be helpful.
0 Kudos
BrettLord-Castillo
Deactivated User
If the event is already fired when you do your connect, then the connected function will not fire. This can create race conditions. An easy way to handled race conditions for on time function calls is to use dojo.Deferred instead.
0 Kudos