diff --git a/debug/rtl.html b/debug/rtl.html new file mode 100644 index 00000000000..3e8426d0d2d --- /dev/null +++ b/debug/rtl.html @@ -0,0 +1,39 @@ + + + + Mapbox GL JS debug page + + + + + + + +
+ + + + + + diff --git a/docs/documentation.yml b/docs/documentation.yml index a18414fbd45..deade7cc72e 100644 --- a/docs/documentation.yml +++ b/docs/documentation.yml @@ -7,6 +7,7 @@ toc: - supported - version - setRTLTextPlugin + - rtlTextPluginRequested - clearStorage - AnimationOptions - CameraOptions diff --git a/src/index.js b/src/index.js index f6e5eddac9c..ba64b8a9f5b 100644 --- a/src/index.js +++ b/src/index.js @@ -19,7 +19,7 @@ import Point from '@mapbox/point-geometry'; import MercatorCoordinate from './geo/mercator_coordinate'; import {Evented} from './util/evented'; import config from './util/config'; -import {setRTLTextPlugin} from './source/rtl_text_plugin'; +import {setRTLTextPlugin, rtlTextPluginRequested} from './source/rtl_text_plugin'; import WorkerPool from './util/worker_pool'; import {clearTileCache} from './util/tile_request_cache'; @@ -91,6 +91,19 @@ const exported = { WorkerPool.workerCount = count; }, + /** + * Gets a boolean indicating whether or not the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text) has been previously requested + * + * @var {string} rtlTextPluginRequested + * @example + * if (!mapboxgl.rtlTextPluginRequested) { + * mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js'); + * } + */ + get rtlTextPluginRequested(): boolean { + return rtlTextPluginRequested(); + }, + /** * Gets and sets the maximum number of images (raster tiles, sprites, icons) to load in parallel, * which affects performance in raster-heavy maps. 16 by default. diff --git a/src/source/rtl_text_plugin.js b/src/source/rtl_text_plugin.js index 66b53b31a0b..7a0830fe06f 100644 --- a/src/source/rtl_text_plugin.js +++ b/src/source/rtl_text_plugin.js @@ -25,6 +25,10 @@ export const registerForPluginAvailability = function( return callback; }; +export const rtlTextPluginRequested = function () { + return pluginRequested; +}; + export const clearRTLTextPlugin = function() { pluginRequested = false; pluginURL = null;