Convert ol.ObjectEvent#getKey method into key property

This commit is contained in:
Tom Payne
2014-01-23 20:03:39 +01:00
parent 45350a34ed
commit 37351c530c
5 changed files with 27 additions and 30 deletions

View File

@@ -33,6 +33,7 @@ ol.ObjectEventType = {
* @param {string} type The event type.
* @param {string} key The property name.
* @extends {goog.events.Event}
* @implements {oli.ObjectEvent}
* @constructor
*/
ol.ObjectEvent = function(type, key) {
@@ -41,23 +42,13 @@ 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
@@ -277,7 +268,7 @@ ol.Object.prototype.createBeforeChangeListener_ = function(key, targetKey) {
* @this {ol.Object}
*/
return function(event) {
if (event.getKey() === targetKey) {
if (event.key === targetKey) {
this.dispatchEvent(
new ol.ObjectEvent(ol.ObjectEventType.BEFOREPROPERTYCHANGE, key));
}