diff --git a/static/js/map/RealtimeTileLayer.js b/static/js/map/RealtimeTileLayer.js index d442db9..e5c99bd 100644 --- a/static/js/map/RealtimeTileLayer.js +++ b/static/js/map/RealtimeTileLayer.js @@ -36,10 +36,15 @@ export default L.TileLayer.extend({ return "tile-" + this.layerId + "/" + x + "/" + y + "/" + zoom; }, - createTile: function(coords){ + createTile: function(coords, done){ var tile = document.createElement('img'); tile.src = this.getTileSource(coords.x, coords.y, coords.z, true); tile.id = this.getImageId(coords.x, coords.y, coords.z); + + // trigger callbacks + tile.onload = () => done(null, tile); + tile.onerror = e => done(e, tile); + return tile; } });