async function initLocation()

in web-app-pix2info-python/src/frontend/scripts.js [673:694]


async function initLocation() {
    eLocation.innerHTML = ''
    const locations = await getLocations()
    if (!locations) return

    let match = false
    for (const location of locations) {
        const option = document.createElement('sl-option')
        option.textContent = option.value = location
        eLocation.appendChild(option)
        if (location == gParams.apiLocation) match = true
    }
    if (!match) gParams.apiLocation = null

    if (!gParams.apiLocation && 0 < locations.length)
        gParams.apiLocation = locations[0]

    if (gParams.apiLocation) {
        eLocation.value = gParams.apiLocation
        await onLocationChanged(null) // Will call initProcessors
    }
}