Solved! Go to Solution.
on(map, "layer-add-result", function(layerAdded, errorMsg){ if(layerAdded.layer === myLayer){ console.log('found the layer i want, do something specific'); } });
on(map, "layer-add-result", function(layerAdded, errorMsg){ if(layerAdded.layer === myLayer){ console.log('found the layer i want, do something specific'); } });
The 'layer-add-result' event actually returns the layer that was added to the map in the callback.
You would have to check in the callback which layer was added and then do something based on that.
http://jsfiddle.net/tE4A3/7/on(map, "layer-add-result", function(layerAdded, errorMsg){ if(layerAdded.layer === myLayer){ console.log('found the layer i want, do something specific'); } });