Simpler type for ol.events.Key

Instead of having `ol.events.Key` be a listener object or an array of listener objects, it should be less error prone to have it just be a single listener object.

To avoid using too many functions with multiple return types, the `ol.events.*` functions for registering and unregistering listeners no longer accept an array of event types (and only a single key is returned when registering).

To make it convenient for users to register multiple listeners at once, the `observable.on()` method accepts an array of event types.  Internally in the library, we should use the less risky `ol.events.listen()`.
This commit is contained in:
Tim Schaub
2016-02-02 12:20:18 -07:00
committed by Andreas Hocevar
parent 78f44dcc8a
commit f10c90bdba
15 changed files with 173 additions and 108 deletions
+5 -2
View File
@@ -153,8 +153,11 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
this.dropListenKeys_ = [
ol.events.listen(dropArea, ol.events.EventType.DROP,
ol.interaction.DragAndDrop.handleDrop_, this),
ol.events.listen(dropArea, [ol.events.EventType.DRAGENTER,
ol.events.EventType.DRAGOVER, ol.events.EventType.DROP],
ol.events.listen(dropArea, ol.events.EventType.DRAGENTER,
ol.interaction.DragAndDrop.handleStop_, this),
ol.events.listen(dropArea, ol.events.EventType.DRAGOVER,
ol.interaction.DragAndDrop.handleStop_, this),
ol.events.listen(dropArea, ol.events.EventType.DROP,
ol.interaction.DragAndDrop.handleStop_, this)
]
}