When handling an update-start event from a layer, is there a way to derive which layer threw the event? The event seems to have no args.
Typically your event handler function is specific to your layer so it should be self evident; in other words if you have specific functions for layer1 then you put those in the layer1 event handler, and functions for layer2 go in the layer2 event handler. But if you want some kind of visual cue you can either put some console.log statements into your event handler functions like this:
...or you can examine the evt object to get the layer id, name, url, etc.
Thanks for the reply. My site has dynamically added layers, so having a custom hardcoded function for each is not an option.
The evt object sounds great...except it's always undefined (or is for me, anyways). The API documentation seems to support this. Do you actually see values in your evt param?
I have been able to hack around the issue by having the handler be defined on the layer object itself, and can then find out who raised the event using the "this" variable. Will do for now but pretty messy.
Yes, my evt object is populated with properties. When I do
... it prints the layer name in the console (firebug). And when I do
I can explore the entire object.
I just tried a bare-bones example and yep, it has a value. So something in my big scary app must be breaking it, but that's not the API's fault. Thank you for your time.
Retrieving data ...