trigger done callbacks

This commit is contained in:
BuckarooBanzay 2020-06-12 15:29:54 +02:00
parent 14a5e7da36
commit 45c8efebe8

View File

@ -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;
}
});