If is relatively common for users to animate geometries on the map using GeoJSONSource#setData
It can be hard to do so performantly and without causing the queue of data update operations to become seriously clogged.
We could make this use of GL JS easier via a newMap#requestSetDataFrame(sourceId: string, callback: Function) method (analogous to requestAnimationFrame).
function requestSetDataFrame(map, sourceId, callback) {
var countdown = 2;
function dataCallback() {
if (map.style.sourceCaches[sourceId].loaded()) {
if (--countdown === 0) callback(performance.now());
} else {
map.once('data', dataCallback);
}
}
dataCallback();
requestAnimationFrame(function(now) {
if (--countdown === 0) callback(now);
});
}
If is relatively common for users to animate geometries on the map using
GeoJSONSource#setDataIt can be hard to do so performantly and without causing the queue of data update operations to become seriously clogged.
We could make this use of GL JS easier via a new
Map#requestSetDataFrame(sourceId: string, callback: Function)method (analogous torequestAnimationFrame).