allartk / leaflet.offline

Leaflet offline layer
https://allartk.github.io/leaflet.offline/
GNU Lesser General Public License v3.0
288 stars 72 forks source link

Cache as you browse #358

Closed cr3a7ure closed 3 months ago

cr3a7ure commented 3 months ago

Hi again,

I was wondering whether there is already a way to cache the tiles as you browse. This would reduce the new tiles to download but would add space. Currently I notice that the browser will cache some images and then the library will retrieve them from the browser's cache. But I would like to have more control on it.

I was thinking to add an event on every layer when the zoom changes and initiate download extent. Do you think it is easy to refactor and add it as an option on the TileLayer Class?

Thank you

cr3a7ure commented 3 months ago

To answer my own question for someone else. There is an example already in place: