leaflet.offline
leaflet.offline copied to clipboard
interrupting the download process
How can I stop the download process? I've tried everything. In the following example, I want to interrupt it after 10 tiles, but nothing works. As a result, I need to add a button to cancel the download
const controlSaveTiles = useRef<ControlSaveTiles | null>(null);
....
tileLayerOffline.current.on("savetileend", (e) => {
progress += 1;
setProgress(progress);
if (controlSaveTiles.current && controlSaveTiles.current.status) {
if (controlSaveTiles.current.status.lengthSaved>=10){
controlSaveTiles.current.status.lengthLoaded = controlSaveTiles.current.status.lengthSaved;
controlSaveTiles.current.status.lengthToBeSaved = controlSaveTiles.current.status.lengthSaved;
controlSaveTiles.current.status._tilesforSave=[];
}
}