Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ol.CollectionEvent#getElement #929

Merged
merged 4 commits into from Aug 28, 2013
Merged

Add ol.CollectionEvent#getElement #929

merged 4 commits into from Aug 28, 2013

Conversation

elemoine
Copy link
Member

ol.Collection objects trigger "add" and "remove" events when element are added to, and removed from, the collection. This is very useful; to be notified when layers are added/removed to/from the map for example. Currently, applications using ol.js can register "add" and "remove" listeners, but they cannot get a reference to the element to which "add" and "remove" events pertain. Quite annoying. This PR adds a getElement method to ol.Collection, and export it.

@fredj
Copy link
Member

fredj commented Aug 28, 2013

LGTM

@elemoine
Copy link
Member Author

Quick note: I would have liked to "export" the elem property instead of adding a getter, but I'm not aware of a good way to do that. I considered using the new @dict annotation, but @dict classes cannot extent unannotated classes, and goog.events.Event is not @dict. And also, we already use getters for ol.MapBrowserEvent (getPixel, getCoordinate).

@elemoine
Copy link
Member Author

Thanks for the review @fredj.

elemoine pushed a commit that referenced this pull request Aug 28, 2013
Add ol.CollectionEvent#getElement
@elemoine elemoine merged commit c608e15 into openlayers:master Aug 28, 2013
@elemoine elemoine deleted the collectionevent branch August 28, 2013 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants