As a final part of the event enhancements, I'd like to get in the ability to set event listeners at construction (for an object that has an events instance). This lets you write
map = new OpenLayers.Map("map", {
eventListeners: {
"moveend": mapEvent,
"zoomend": mapEvent,
"changelayer": mapLayerChanged,
"changebaselayer": mapBaseLayerChanged
}
});
as an alternative to the current
map = new OpenLayers.Map("map");
map.events.register("moveend", null, mapEvent);
map.events.register("zoomend", null, mapEvent);
map.events.register("changelayer", null, mapLayerChanged);
map.events.register("changebaselayer", null, mapBaseLayerChanged);
See this example.
Again, this was an oversight on my part not to make a ticket earlier. I'd like to kick this last change out of that events sandbox before 2.6 is out the door. Complaints welcome. Patch forthcoming.