Extending FeatureLoader type and refactoring loadFeaturesXhr

This commit is contained in:
Simon Seyock
2020-10-06 10:28:07 +02:00
parent 1ec6713f31
commit 393e83cd29
2 changed files with 123 additions and 102 deletions

View File

@@ -528,11 +528,22 @@ export default VectorTile;
* @param {string} url URL.
*/
export function defaultLoadFunction(tile, url) {
const loader = loadFeaturesXhr(
url,
tile.getFormat(),
tile.onLoad.bind(tile),
tile.onError.bind(tile)
tile.setLoader(
/**
* @param {import("../extent.js").Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {import("../proj/Projection.js").default} projection Projection.
*/
function (extent, resolution, projection) {
loadFeaturesXhr(
url,
tile.getFormat(),
extent,
resolution,
projection,
tile.onLoad.bind(tile),
tile.onError.bind(tile)
);
}
);
tile.setLoader(loader);
}