Mapbox-gl-js: Mapbox setRTLTextPlugin cannot be called multiple times

Created on 9 Dec 2019  路  1Comment  路  Source: mapbox/mapbox-gl-js

Hi,

See issue #4859 for more details. this issue still exists in latest version, so I opened this one because that issue is closed.

<script src='https://api.mapbox.com/mapbox.js/v3.2.1/mapbox.js'></script>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.6.0/mapbox-gl.js'></script>

// then
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js');

Most helpful comment

Hey @dehghani-mehdi ,
We've added a getRTLTextPluginStatus (https://github.com/mapbox/mapbox-gl-js/blob/c82a0b8c89bb964824996e25f54c31cfaf419e61/src/index.js#L173), so you can query the state of the plugin and prevent calling the plugin twice in your app.

The plugin itself should not be downloaded multiple times since one global instance is used for all maps on the page.

I'm reopening the original issue #4859, since it describes the problem better.

>All comments

Hey @dehghani-mehdi ,
We've added a getRTLTextPluginStatus (https://github.com/mapbox/mapbox-gl-js/blob/c82a0b8c89bb964824996e25f54c31cfaf419e61/src/index.js#L173), so you can query the state of the plugin and prevent calling the plugin twice in your app.

The plugin itself should not be downloaded multiple times since one global instance is used for all maps on the page.

I'm reopening the original issue #4859, since it describes the problem better.

Was this page helpful?
0 / 5 - 0 ratings