Store revision number in sources and update it on changes

This commit is contained in:
Tom Payne
2013-09-06 15:30:21 +02:00
committed by Éric Lemoine
parent 4f27dd35d8
commit cd0186dde5

View File

@@ -45,6 +45,12 @@ ol.source.Source = function(options) {
*/
this.logo_ = options.logo;
/**
* @private
* @type {number}
*/
this.revision_ = 0;
};
goog.inherits(ol.source.Source, goog.events.EventTarget);
@@ -53,6 +59,7 @@ goog.inherits(ol.source.Source, goog.events.EventTarget);
* @protected
*/
ol.source.Source.prototype.dispatchChangeEvent = function() {
++this.revision_;
this.dispatchEvent(goog.events.EventType.CHANGE);
};
@@ -61,6 +68,7 @@ ol.source.Source.prototype.dispatchChangeEvent = function() {
* @protected
*/
ol.source.Source.prototype.dispatchLoadEvent = function() {
++this.revision_;
this.dispatchEvent(goog.events.EventType.LOAD);
};
@@ -103,6 +111,14 @@ ol.source.Source.prototype.getProjection = function() {
ol.source.Source.prototype.getResolutions = goog.abstractMethod;
/**
* @return {number} Revision.
*/
ol.source.Source.prototype.getRevision = function() {
return this.revision_;
};
/**
* @return {boolean} Is ready.
*/