Pre-warm map resources to make subsequent loads faster

This commit is contained in:
Skylar Ittner 2022-05-02 18:34:19 -06:00
parent c5e52c7845
commit 77da43f2bc
2 changed files with 7 additions and 4 deletions

View File

@ -10,6 +10,9 @@ var firstload = true;
function mapboxMap() { function mapboxMap() {
/* Pre-load workers and stuff, and enable re-using them even after map unloaded */
mapboxgl.prewarm();
var mapsource = "auto"; var mapsource = "auto";
if (getStorage("mapsource") == null) { if (getStorage("mapsource") == null) {

View File

@ -27,10 +27,10 @@ var SETTINGS = {
bgcolor: "#EDF5F3" bgcolor: "#EDF5F3"
}, },
satellite: { satellite: {
url: "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token={mapboxpublictoken}", url: "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token={mapboxpublictoken}",
json: "mapbox://styles/mapbox/satellite-streets-v11", json: "mapbox://styles/mapbox/satellite-streets-v11",
name: "Satellite", name: "Satellite",
bgcolor: "#EDF5F3" bgcolor: "#EDF5F3"
}, },
fiord: { fiord: {
url: "https://maps.netsyms.net/styles/fiord-color/{z}/{x}/{y}.png", url: "https://maps.netsyms.net/styles/fiord-color/{z}/{x}/{y}.png",