Question

I found in an example for OpenLayers this code to register a listener on OpenLayers.Control.SelectFeature

var report = function(e) {
     OpenLayers.Console.log(e.type, e.feature.id);
};

var highlightCtrl = new OpenLayers.Control.SelectFeature(vectors, {
    hover: true,
    highlightOnly: true,
    renderIntent: "temporary",
    eventListeners: {
            beforefeaturehighlighted: report,
            featurehighlighted: report,
            featureunhighlighted: report
    }
});

Now I'm wondering what exactly e is. What type is e and what other attributes besides type and feature doese e have? Where can I find the documentation for this?

Was it helpful?

Solution

you can find other attributes of e by using IE to debug

OTHER TIPS

In your example, the 'report' method is called a "callback method", which gets triggered when the event occurs. If you look at the SelectFeature control highlight method, you'll see that "beforefeaturehighlighted" gets triggered first. Take a look at the arguments of the method:

var cont = this.events.triggerEvent("beforefeaturehighlighted", {
    feature : feature
});

First one is the name of the event, second one is the parameters to send to the callback method. So, if you inspect your 'e' variable, as Begisen suggested, you'll see that e.feature is available.

That's what your e variable is.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top