Skip to content

Commit

Permalink
add example code for reloadErrorTileFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn committed Oct 14, 2024
1 parent d76c3cf commit 65a3a52
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/renderer/layer/tilelayer/TileLayerCanvasRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,14 @@ class TileLayerCanvasRenderer extends CanvasRenderer {
if (!this.layer) {
return;
}
// example:
/* reloadErrorTileFunction: (layer, renderer, tileInfo, tileImage) => {
const url = tileInfo.url;
// check if need to reload, e.g. server return 500 status code temporarily
if (needReload) {
renderer.loadTile(tileInfo, tileImage);
}
} */
const reloadErrorTileFunction = this.layer.options['reloadErrorTileFunction'];
if (reloadErrorTileFunction) {
reloadErrorTileFunction.call(this, this.layer, this, tileInfo, tileImage);
Expand Down

0 comments on commit 65a3a52

Please sign in to comment.