From 45c8efebe8531837efb8f8d766194d299134ca9e Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Fri, 12 Jun 2020 15:29:54 +0200 Subject: [PATCH] trigger done callbacks --- static/js/map/RealtimeTileLayer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } });