in public/main.js [22:52]
async function start() {
let config;
try {
const response = await fetch('config.json');
config = await response.json();
} catch (e) {
console.error(`Config file is missing or invalid`);
return;
}
const urlTokens = new URL(window.location, true);
const emsClient = await getEmsClient(config, urlTokens.query.manifest, urlTokens.query.locale);
if (!emsClient) {
console.error(`Cannot load the required manifest for "${urlTokens.query.manifest}"`);
return;
} else {
console.info(`EMS Client ${emsClient._emsVersion} loaded`);
}
const emsLayers = {
file: await emsClient.getFileLayers(),
tms: await emsClient.getTMSServices(),
};
const serviceName = config.serviceName || 'Elastic Maps Service';
const container = document.getElementById('wrapper');
const root = createRoot(container);
root.render(
<App client={emsClient} serviceName={serviceName} layers={emsLayers} />,
);
}