Skip to content

Commit

Permalink
Add documentation for "data" event
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wojciechowski committed Sep 26, 2016
1 parent f7c5d53 commit 1ef4213
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ toc:
- MapMouseEvent
- MapTouchEvent
- MapBoxZoomEvent
- MapDataEvent
- name: Types
description: |
These are types used in the documentation above to describe arguments,
Expand Down
30 changes: 29 additions & 1 deletion js/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ function removeNode(node) {
*/

/**
* Fired if any error occurs. This is GL JS's primary error reporting
* Fired when an error occurs. This is GL JS's primary error reporting
* mechanism. We use an event instead of `throw` to better accommodate
* asyncronous operations. If no listeners are bound to the `error` event, the
* error will be printed to the console.
Expand All @@ -1380,3 +1380,31 @@ function removeNode(node) {
* @instance
* @property {{error: {message: string}}} data
*/

/**
* Fired when any map data (style, source, tile, etc) loads or changes. See
* [`MapDataEvent`](#MapDataEvent) for more information.
*
* @event data
* @memberof Map
* @instance
* @property {MapDataEvent} data
*/

/**
* A `MapDataEvent` object is attached to the [`Map#data`](#Map.event:data) event.
* The `Map#data` event is fired when any map data loads or changes. The types
* of map data are:
*
* - `'GeoJSON'`: [GeoJSON](http://geojson.org/) data associated with a `geojson` source.
* - `'TileJSON'`: [TileJSON](https://github.com/mapbox/tilejson-spec) metadata associated with a `vector` or `raster` source.
* - `'style'`: The [style](https://www.mapbox.com/mapbox-gl-style-spec/) used by the map
* - `'sprite'`: The icons and patterns used by the style
* - `'image'`: A `image` source's image and coordinates
* - `'video'`: A `video` source's video and coordinates
* - `'tile'`: A vector or raster tile
*
* @typedef {Object} MapDataEvent
* @property {string} type The event type.
* @property {string} dataType The type of data that has changed. One of `'geoJSON'`, `'tileJSON'`, `'style'`, `'sprite'`, `'image'`, `'video'`, or `'tile'`.
*/

0 comments on commit 1ef4213

Please sign in to comment.