Export a getKey method on ol.ObjectEvent

This commit is contained in:
Tim Schaub
2013-12-12 15:08:09 -07:00
parent 69385f4ff0
commit 20d74810ab
4 changed files with 29 additions and 16 deletions

View File

@@ -41,13 +41,23 @@ ol.ObjectEvent = function(type, key) {
/**
* The name of the property whose value is changing.
* @type {string}
* @private
*/
this.key = key;
this.key_ = key;
};
goog.inherits(ol.ObjectEvent, goog.events.Event);
/**
* Get the name of the property associated with this event.
* @return {string} Object property name.
*/
ol.ObjectEvent.prototype.getKey = function() {
return this.key_;
};
/**
* @constructor
@@ -286,7 +296,7 @@ ol.Object.prototype.createBeforeChangeListener_ = function(key, targetKey) {
* @this {ol.Object}
*/
return function(event) {
if (event.key === targetKey) {
if (event.getKey() === targetKey) {
this.dispatchEvent(
new ol.ObjectEvent(ol.ObjectEventType.BEFOREPROPERTYCHANGE, key));
}