@@ -3,7 +3,6 @@ import { Extent, getTopLeft, getBottomRight, getTopRight } from 'ol/extent';
3
3
import { toLonLat } from 'ol/proj' ;
4
4
import { Coordinate } from 'ol/coordinate' ;
5
5
import { TileCoord } from 'ol/tilecoord' ;
6
- import * as localforage from 'localforage'
7
6
import { getCacheId , getTileCacher } from '../sources/cachingSource' ;
8
7
import { linzTopo } from '../layers/layerDefinitions' ;
9
8
const ESTIMATED_TILE_SIZE = 40 * 1024 ; // Estimate each tile at 40kb.
@@ -86,25 +85,19 @@ export class TileDownloader {
86
85
while ( ! result . done ) {
87
86
const tile = result . value ;
88
87
const url = urlFunc ( [ tile . z , tile . x , tile . y ] ) ;
89
- const cacheId = getCacheId ( linzTopo , [ tile . z , tile . x , tile . y ] ) ;
88
+ getCacheId ( linzTopo , [ tile . z , tile . x , tile . y ] ) ;
90
89
await cacher ( [ tile . z , tile . x , tile . y ] , url ) ;
91
- // Only download tiles we haven't seen.
92
- if ( ! await localforage . getItem ( cacheId ) ) {
93
- const response = await fetch ( url ) ;
94
- const blob = await response . blob ( ) ;
95
- await localforage . setItem ( cacheId , blob ) ;
96
- }
97
90
98
91
downloadedTiles += 1 ;
99
92
onProgress ( downloadedTiles / totalTiles ) ;
100
93
result = queue . next ( ) ;
101
94
}
102
95
}
103
96
104
- const workers = [ ] ;
97
+ const workers : Promise < void > [ ] = [ ] ;
105
98
for ( let i = 0 ; i < this . numWorkers ; ++ i )
106
99
workers . push ( worker ( ) ) ;
107
100
108
101
await Promise . all ( workers ) ;
109
102
}
110
- }
103
+ }
0 commit comments