Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ L.TileLayer.Bing = L.TileLayer.extend({
this._attributions.forEach(function (attribution) {
map.attributionControl.removeAttribution(attribution)
})
this._attributions = []
L.TileLayer.prototype.onRemove.call(this, map)
},

Expand Down Expand Up @@ -231,6 +232,9 @@ L.TileLayer.Bing = L.TileLayer.extend({
var zoom = map.getZoom()
var bbox = toBingBBox(map.getBounds().toBBoxString())
this._fetch.then(function () {
// Layer has been removed during fetch
if (!this._map) return

var newAttributions = this._getAttributions(bbox, zoom)
var prevAttributions = this._attributions
// Add any new provider attributions in the current area to the attribution control
Expand Down