Only listen once for tile events
Assuming browser garbage collection cannot happen while we have listeners in the global registry, we need to listenOnce to avoid memory leaks with the tile queue.
This commit is contained in:
@@ -174,7 +174,7 @@ ol.TileQueue.prototype.loadMoreTiles = function() {
|
||||
var tile;
|
||||
while (this.heap_.length > 0 && this.tilesLoading_ < this.maxTilesLoading_) {
|
||||
tile = /** @type {ol.Tile} */ (this.dequeue_());
|
||||
goog.events.listen(tile, goog.events.EventType.CHANGE,
|
||||
goog.events.listenOnce(tile, goog.events.EventType.CHANGE,
|
||||
this.handleTileChange, false, this);
|
||||
tile.load();
|
||||
++this.tilesLoading_;
|
||||
|
||||
Reference in New Issue
Block a user