/
index.js
92 lines (83 loc) · 3.09 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// @flow
const supported = require('mapbox-gl-supported');
const browser = require('./util/browser');
const version: string = require('../package.json').version;
const Map = require('./ui/map');
const NavigationControl = require('./ui/control/navigation_control');
const GeolocateControl = require('./ui/control/geolocate_control');
const AttributionControl = require('./ui/control/attribution_control');
const ScaleControl = require('./ui/control/scale_control');
const FullscreenControl = require('./ui/control/fullscreen_control');
const Popup = require('./ui/popup');
const Marker = require('./ui/marker');
const Style = require('./style/style');
const LngLat = require('./geo/lng_lat');
const LngLatBounds = require('./geo/lng_lat_bounds');
const Point = require('point-geometry');
const Evented = require('./util/evented');
const config = require('./util/config');
const rtlTextPlugin = require('./source/rtl_text_plugin');
module.exports = {
version,
supported,
workerCount: Math.max(Math.floor(browser.hardwareConcurrency / 2), 1),
setRTLTextPlugin: rtlTextPlugin.setRTLTextPlugin,
Map,
NavigationControl,
GeolocateControl,
AttributionControl,
ScaleControl,
FullscreenControl,
Popup,
Marker,
Style,
LngLat,
LngLatBounds,
Point,
Evented,
config,
/**
* Gets and sets the map's [access token](https://www.mapbox.com/help/define-access-token/).
*
* @var {string} accessToken
* @example
* mapboxgl.accessToken = myAccessToken;
* @see [Display a map](https://www.mapbox.com/mapbox-gl-js/examples/)
*/
get accessToken() {
return config.ACCESS_TOKEN;
},
set accessToken(token: string) {
config.ACCESS_TOKEN = token;
}
};
/**
* The version of Mapbox GL JS in use as specified in `package.json`,
* `CHANGELOG.md`, and the GitHub release.
*
* @var {string} version
*/
/**
* Test whether the browser [supports Mapbox GL JS](https://www.mapbox.com/help/mapbox-browser-support/#mapbox-gl-js).
*
* @function supported
* @param {Object} [options]
* @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`,
* the function will return `false` if the performance of Mapbox GL JS would
* be dramatically worse than expected (e.g. a software WebGL renderer would be used).
* @return {boolean}
* @example
* mapboxgl.supported() // = true
* @see [Check for browser support](https://www.mapbox.com/mapbox-gl-js/example/check-for-support/)
*/
/**
* Sets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text).
* Necessary for supporting languages like Arabic and Hebrew that are written right-to-left.
*
* @function setRTLTextPlugin
* @param {string} pluginURL URL pointing to the Mapbox RTL text plugin source.
* @param {Function} callback Called with an error argument if there is an error.
* @example
* mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.1/mapbox-gl-rtl-text.js');
* @see [Add support for right-to-left scripts](https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-rtl-text/)
*/