The type of data that has changed. One of 'source'
, 'style'
.
Included if the event has a dataType
of source
and the event signals that internal data has been received or changed. Possible values are metadata
, content
, visibility
and idle
.
The event type.
// The sourcedata event is an example of MapDataEvent.
// Set up an event listener on the map.
map.on('sourcedata', (e) => {
if (e.isSourceLoaded) {
// Do something when the source has finished loading
}
});
A
MapDataEvent
object is emitted with thedata
anddataloading
events. Possible values fordataType
s are:'source'
: The non-tile data associated with any source'style'
: The style used by the mapPossible values for
sourceDataType
s are:'metadata'
: indicates that any necessary source metadata has been loaded (such as TileJSON) and it is ok to start loading tiles'content'
: indicates the source data has changed (such as when source.setData() has been called on GeoJSONSource)'visibility'
: send when the source becomes used when at least one of its layers becomes visible in style sense (inside the layer's zoom range and with layout.visibility set to 'visible')'idle'
: indicates that no new source data has been fetched (but the source has done loading)