Base URL directory where worker scripts are hosted (without trailing slash) Example: "https://cdn.example.com/workers"
import { setWorkersUrl } from '@mappedin/mappedin-js';
// Call before initializing any maps
setWorkersUrl('https://cdn.example.com/workers');
// This will load:
// - https://cdn.example.com/workers/maplibre-worker.csp.js
// - https://cdn.example.com/workers/collision-worker.csp.js
node_modules/@mappedin/mappedin-js/lib/esm/workers/
Sets the base URL directory where worker scripts are hosted for CSP compatibility.
This function configures both the MapLibre and collision system workers to load from external URLs instead of using inline blob URLs. The SDK expects two specific worker files to be available in the provided directory:
maplibre-worker.csp.js- For MapLibre map renderingcollision-worker.csp.js- For the collision detection systemUsing this approach enables compatibility with strict Content Security Policies that block unsafe-eval and blob: URLs.