Ticket #2629 (closed feature: wontfix)
OpenLayers.Event: new transversal method addListener.
|Reported by:||jorix||Owned by:||jorix|
Advantages of the addListener method:
- This ensures the call of "un" method and the destruction of events
- The developer will forget to call "un" or "unregister" methods
- No are required properties to store: Events instances or functions for call "un" method
- The code is shorter (and better)
- Can register listeners to another object. with correct unregister when object destroy.
Contents of the patch:
- The new methods:
- Base classes which are implemented:
- How to use in a particular case:
- MousePosition.js (to allow activation/deactivation)
- examples/mouse-position.html (to regiter listeners to another object)
Note that in original MousePosition.js missing unregister of 'mouseout', would not have happened using addListener (therefore the code will be better).
This ticket contains only part of #2577, and is designed to facilitate the reading of the addListener methods within the patch. It has also modified some of the documentation.
SVN revision: 10299