Add a clear() method for tile sources

This commit is contained in:
ahocevar
2019-02-20 20:37:22 +01:00
parent 8557bd96b5
commit a0ba8dd8c6
2 changed files with 71 additions and 2 deletions

View File

@@ -300,12 +300,20 @@ class TileSource extends Source {
return withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null;
}
/**
* Remove all cached tiles from the source. The next render cycle will fetch new tiles.
* @api
*/
clear() {
this.tileCache.clear();
}
/**
* @inheritDoc
*/
refresh() {
this.tileCache.clear();
this.changed();
this.clear();
super.refresh();
}
/**