'Mapbox event when brand new tile is loaded

I'm using Mapbox GL JS API to manipulate a Mapbox map. My question if there's an event that's capable of telling me for each HTTP request for new tile? I finish with a code like this:

  map.on("dataloading", e => {
   if(e.dataType === "source" && e.source.url && e.tile) {
     //Fresh HTTP request to Mapbox API ?
   }
  });

Im using this & this docs



Solution 1:[1]

It's not the primary purpose, but you should be able to use map.transformRequest to achieve this goal. It gets called for every request, so you'll just have to check whether it's loading a tile or something else.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Steve Bennett