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:
committed by
Andreas Hocevar
parent
78f44dcc8a
commit
f10c90bdba
@@ -107,10 +107,10 @@ ol.control.Control.prototype.setMap = function(map) {
|
||||
if (this.map_) {
|
||||
goog.dom.removeNode(this.element);
|
||||
}
|
||||
if (this.listenerKeys.length > 0) {
|
||||
ol.events.unlistenByKey(this.listenerKeys);
|
||||
this.listenerKeys.length = 0;
|
||||
for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
|
||||
ol.events.unlistenByKey(this.listenerKeys[i]);
|
||||
}
|
||||
this.listenerKeys.length = 0;
|
||||
this.map_ = map;
|
||||
if (this.map_) {
|
||||
var target = this.target_ ?
|
||||
|
||||
Reference in New Issue
Block a user