I am building a map application, calling layers from an arcgis-server using the javascript api.
Maybe I am being stubborn, but I am trying to minimize my use of dojo throughout this process. Much of my previous experience has been using other APIs like cartoDb, google maps and I prefer using jquery and pure javaScript.
I am going to build a dynamic list of layers and legend items by iterating through the layerInfos of the dynamicMapServiceLayer that I have added to my map.
I have found that I cannot itterate through the layerInfos until after the layer has been added to the map. To detect this I am using the onLayerAdd event. The only way I've been able to use the onLayerAdd event is to also use a dojo.connect
dojo.connect(map, "onLayerAdd",testFunction);
Do I have to use dojo.connect? If so why? It seems like it would make more sense to do something like
map.onLayerAdd(testFunction)
Thanks in advance....