Closed IagoLast closed 6 years ago
As long as I know, we only have full control over the layer objects, and its better not to pollute the mapbox namespace. So my approach would be something like:
layer.on('loaded', callback);
Map loaded can be a syntetic-event
fired when all layers are loaded.
@davidmanzanares any idea about how to implement this?
Should be layer.on('load', callback);
to be Mapbox GL naming consistent.
The data layer should have an internal mechanism to let the layer know that everything needed is loaded. This could be another callback parameter to the _bindLayer()
method. Once this is fired Layer
must keep track of the "All data is here" state and then, after 2 repaints (in the moment the first repaint happens the data is painted over the GL context, but that the framebuffer hasn't been swapped yet) it should fire the event.
Regarding the implementation on the Dataset
class, you need to keep track of the last requested tiles, and each time a new tile is returned from the server, you need to check if this is the last one you needed to inform the layer.
It would be nice to have a mechanism to know when the map is fully loaded.