leaflet.offline icon indicating copy to clipboard operation
leaflet.offline copied to clipboard

interrupting the download process

Open jhianik opened this issue 4 months ago • 0 comments

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=[];  
         
            
        }
 

      }

image

jhianik avatar Oct 10 '24 09:10 jhianik