forEachFeatureInExtent(extent, callback) {
    if (this.featuresRtree_) {
      return this.featuresRtree_.forEachInExtent(extent, callback);
    }
    if (this.featuresCollection_) {
      this.featuresCollection_.forEach(callback);
    }
  }
Iterate through all features whose bounding box intersects the provided
extent (note that the feature's geometry may not intersect the extent),
calling the callback with each feature.  If the callback returns a "truthy"
value, iteration will stop and the function will return the same value.

If you are interested in features whose geometry intersects an extent, call
the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead.

When `useSpatialIndex` is set to false, this method will loop through all
features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.

@param {import("../extent.js").Extent} extent Extent.
@param {function(FeatureType): T} callback Called with each feature
    whose bounding box intersects the provided extent.
@return {T|undefined} The return value from the last call to the callback.
@template T
@api