Don't create unnecessary closure in constructor
This commit is contained in:
@@ -50,32 +50,26 @@ ol.source.StaticVector = function(options) {
|
||||
if (goog.isDef(options.url) || goog.isDef(options.urls)) {
|
||||
this.setState(ol.source.State.LOADING);
|
||||
if (goog.isDef(options.url)) {
|
||||
this.loadFeaturesFromURL(options.url,
|
||||
/**
|
||||
* @param {Array.<ol.Feature>} features Features.
|
||||
* @this {ol.source.StaticVector}
|
||||
*/
|
||||
function(features) {
|
||||
this.addFeaturesInternal(features);
|
||||
this.setState(ol.source.State.READY);
|
||||
}, this);
|
||||
this.loadFeaturesFromURL(options.url, this.onFeaturesLoaded_, this);
|
||||
}
|
||||
if (goog.isDef(options.urls)) {
|
||||
var urls = options.urls;
|
||||
var i, ii;
|
||||
for (i = 0, ii = urls.length; i < ii; ++i) {
|
||||
this.loadFeaturesFromURL(urls[i],
|
||||
/**
|
||||
* @param {Array.<ol.Feature>} features Features.
|
||||
* @this {ol.source.StaticVector}
|
||||
*/
|
||||
function(features) {
|
||||
this.addFeaturesInternal(features);
|
||||
this.setState(ol.source.State.READY);
|
||||
}, this);
|
||||
this.loadFeaturesFromURL(urls[i], this.onFeaturesLoaded_, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
goog.inherits(ol.source.StaticVector, ol.source.FormatVector);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<ol.Feature>} features Features.
|
||||
* @private
|
||||
*/
|
||||
ol.source.StaticVector.prototype.onFeaturesLoaded_ = function(features) {
|
||||
this.addFeaturesInternal(features);
|
||||
this.setState(ol.source.State.READY);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user