Switch to using object urls so we don't need ajax for mapbox-gl-rtl-text plugin (issue #126)

This commit is contained in:
orangemug
2017-04-11 17:29:28 +01:00
parent f97d2b0e88
commit 14cdeae3eb
5 changed files with 15 additions and 21 deletions

11
src/libs/mapbox-rtl.js Normal file
View File

@@ -0,0 +1,11 @@
import MapboxGl from 'mapbox-gl/dist/mapbox-gl.js'
// Load mapbox-gl-rtl-text using object urls without needing http://localhost for AJAX.
const data = require("base64?mimetype=text/javascript!@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.js");
const blob = new window.Blob([window.atob(data)]);
const objectUrl = window.URL.createObjectURL(blob, {
type: "text/javascript"
});
MapboxGl.setRTLTextPlugin(objectUrl);