Merge pull request #8677 from wallw-bits/fix-typecheck-vectorsource

Type check fixes for VectorSource
This commit is contained in:
Tim Schaub
2018-09-21 16:58:24 -06:00
committed by GitHub

View File

@@ -420,6 +420,9 @@ class VectorSource extends Source {
bindFeaturesCollection_(collection) { bindFeaturesCollection_(collection) {
let modifyingCollection = false; let modifyingCollection = false;
listen(this, VectorEventType.ADDFEATURE, listen(this, VectorEventType.ADDFEATURE,
/**
* @param {VectorSourceEvent} evt The vector source event
*/
function(evt) { function(evt) {
if (!modifyingCollection) { if (!modifyingCollection) {
modifyingCollection = true; modifyingCollection = true;
@@ -428,6 +431,9 @@ class VectorSource extends Source {
} }
}); });
listen(this, VectorEventType.REMOVEFEATURE, listen(this, VectorEventType.REMOVEFEATURE,
/**
* @param {VectorSourceEvent} evt The vector source event
*/
function(evt) { function(evt) {
if (!modifyingCollection) { if (!modifyingCollection) {
modifyingCollection = true; modifyingCollection = true;
@@ -436,6 +442,9 @@ class VectorSource extends Source {
} }
}); });
listen(collection, CollectionEventType.ADD, listen(collection, CollectionEventType.ADD,
/**
* @param {import("../Collection.js").CollectionEvent} evt The collection event
*/
function(evt) { function(evt) {
if (!modifyingCollection) { if (!modifyingCollection) {
modifyingCollection = true; modifyingCollection = true;
@@ -444,6 +453,9 @@ class VectorSource extends Source {
} }
}, this); }, this);
listen(collection, CollectionEventType.REMOVE, listen(collection, CollectionEventType.REMOVE,
/**
* @param {import("../Collection.js").CollectionEvent} evt The collection event
*/
function(evt) { function(evt) {
if (!modifyingCollection) { if (!modifyingCollection) {
modifyingCollection = true; modifyingCollection = true;
@@ -511,7 +523,7 @@ class VectorSource extends Source {
if (this.featuresRtree_) { if (this.featuresRtree_) {
return this.featuresRtree_.forEach(callback); return this.featuresRtree_.forEach(callback);
} else if (this.featuresCollection_) { } else if (this.featuresCollection_) {
return this.featuresCollection_.forEach(callback); this.featuresCollection_.forEach(callback);
} }
} }
@@ -564,7 +576,7 @@ class VectorSource extends Source {
if (this.featuresRtree_) { if (this.featuresRtree_) {
return this.featuresRtree_.forEachInExtent(extent, callback); return this.featuresRtree_.forEachInExtent(extent, callback);
} else if (this.featuresCollection_) { } else if (this.featuresCollection_) {
return this.featuresCollection_.forEach(callback); this.featuresCollection_.forEach(callback);
} }
} }
@@ -589,7 +601,6 @@ class VectorSource extends Source {
/** /**
* @param {import("../Feature.js").default} feature Feature. * @param {import("../Feature.js").default} feature Feature.
* @return {T|undefined} The return value from the last call to the callback. * @return {T|undefined} The return value from the last call to the callback.
* @template T
*/ */
function(feature) { function(feature) {
const geometry = feature.getGeometry(); const geometry = feature.getGeometry();