function authVectorTileLoader(fetchOptions) {
  return function(tile, url) {
    const loader = () => {
      fetch(url, fetchOptions)
        .then(r => r.arrayBuffer())
        .then((source) => {
          const format = tile.getFormat();
          tile.setProjection(format.readProjection(source));
          tile.setFeatures(format.readFeatures(source));
          tile.setExtent(format.getLastExtent());
        })
        .catch((err) => {
          tile.onError();
        });
    };

    tile.setLoader(loader);
  };
}
function authVectorTileLoader(fetchOptions) {
  return function(tile, url) {
    const loader = () => {
      fetch(url, fetchOptions)
        .then(r => r.arrayBuffer())
        .then((source) => {
          const format = tile.getFormat();
          tile.setProjection(format.readProjection(source));
          tile.setFeatures(format.readFeatures(source));
          tile.setExtent(format.getLastExtent());
        })
        .catch((err) => {
          tile.onError();
        });
    };

    tile.setLoader(loader);
  };
}
function authVectorTileLoader ( fetchOptions ) { return function ( tile , url ) { const loader = ( ) => { fetch ( url , fetchOptions ) . then ( r => r . arrayBuffer ( ) ) . then ( ( source ) => { const format = tile . getFormat ( ) ; tile . setProjection ( format . readProjection ( source ) ) ; tile . setFeatures ( format . readFeatures ( source ) ) ; tile . setExtent ( format . getLastExtent ( ) ) ; } ) . catch ( ( err ) => { tile . onError ( ) ; } ) ; } ; tile . setLoader ( loader ) ; } ; }
Load a vector tile with full fetchOptions
This is only used when the Authorization header has been set
in the fetchOptions.

@param {Object} fetchOptions Options to use for fetch calls.

@returns {Function} Tile loading function which uses fetch.
Load a vector tile with full fetchOptions This is only used when the Authorization header has been set in the fetchOptions .