Hey, we have an issue with leaflet where we need t...
# fritz2
j
Hey, we have an issue with leaflet where we need to invoke a function after the div is rendered after routing so leaflet can attach itself to the div. The problem is that there seems to be no obvious place to put this code. We have a clicks handler but that invokes the code before the div is rendered. The second time we click it, that actually works. What we would need is some kind of afterRender callback where we can put this logic.
Copy code
div("leaflet-map", id = "map-target"){

    }.loads.events.handledBy(SimpleHandler<UIEvent>() { _,_->
        try {
            GlobalScope.launch {
                delay(1000)
                leafletMap.insert()
            }
        } catch (e: Throwable) {
            console.log(e)
        }
    })
works, but ewwwwww
Any suggestions?
n
doesn't the browser api have events like on page load, after dom ready, etc ? but i guess that is not aware of when the elements from fritz2 are done hmm ?