leaflet.offline trigger save programmatically

Viewed 113

I'm developing a PWA with react-leaflet. I want to be able to cache some data for offline use, including a specific map area. I use leaflet.offline for this. The problem is, the only way I see to download the tiles, is using the leaflet control buttons offered by the library. So I can add the controls to my map with:

const control = L.control.savetiles(offlineLayer, controlOptions)
control.addTo(map)

Now theres two buttons on the map, one for saving and one for removing tiles. This works. But I'd like to be able to trigger these actions from my own UI. Is it possible to trigger a leaflet control programmatically?

0 Answers
Related