gregallensworth / L.TileLayer.Cordova

Leaflet TileLayer subclass which caches to local filesystem, for Cordova/Phonegap
MIT License
87 stars 25 forks source link

Use cached tiles online? #13

Closed jboothe closed 7 years ago

jboothe commented 8 years ago

Will your plugin use cached tiles while online. For instance, user is online and pans to an area that they previously visited. Will the cached tiles be pulled or are cached tiles only used when offline?

Thanks.

gregallensworth commented 8 years ago

See the goOffline() and goOnline() functions. These toggle the cache between online mode and offline mode, in which it uses exclusively the online/network tiles or else the stored/offline tiles.

It would be up to your own application logic to detect a loss of network connectivity, detect a sudden increase in tile-loading failures, etc. and then toggle to online/offline mode accordingly.