Merge pull request #918 from twpayne/source-change-events
Source change events
This commit is contained in:
@@ -28,6 +28,9 @@ ol.layer.Layer = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.source_ = options.source;
|
this.source_ = options.source;
|
||||||
|
|
||||||
|
goog.events.listen(this.source_, goog.events.EventType.CHANGE,
|
||||||
|
this.handleSourceChange_, false, this);
|
||||||
|
|
||||||
if (!this.source_.isReady()) {
|
if (!this.source_.isReady()) {
|
||||||
goog.events.listenOnce(this.source_, goog.events.EventType.LOAD,
|
goog.events.listenOnce(this.source_, goog.events.EventType.LOAD,
|
||||||
this.handleSourceLoad_, false, this);
|
this.handleSourceLoad_, false, this);
|
||||||
@@ -78,6 +81,14 @@ ol.layer.Layer.prototype.getSource = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.layer.Layer.prototype.handleSourceChange_ = function() {
|
||||||
|
this.dispatchChangeEvent();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ ol.source.Source = function(options) {
|
|||||||
goog.inherits(ol.source.Source, goog.events.EventTarget);
|
goog.inherits(ol.source.Source, goog.events.EventTarget);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
ol.source.Source.prototype.dispatchChangeEvent = function() {
|
||||||
|
this.dispatchEvent(goog.events.EventType.CHANGE);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user