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