Propagate change events from sources via layers

This commit is contained in:
Tom Payne
2013-08-21 12:29:49 +02:00
parent 788ac5f41d
commit 0170c426ee

View File

@@ -28,6 +28,9 @@ ol.layer.Layer = function(options) {
*/
this.source_ = options.source;
goog.events.listen(this.source_, goog.events.EventType.CHANGE,
this.handleSourceChange_, false, this);
if (!this.source_.isReady()) {
goog.events.listenOnce(this.source_, goog.events.EventType.LOAD,
this.handleSourceLoad_, false, this);
@@ -78,6 +81,14 @@ ol.layer.Layer.prototype.getSource = function() {
};
/**
* @private
*/
ol.layer.Layer.prototype.handleSourceChange_ = function() {
this.dispatchChangeEvent();
};
/**
* @private
*/