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:
Tim Schaub committed 2013-02-13 15:37:33 -07:00
1 parent 83a00c13fa
commit f5c627ab51
1 file changed
+1 -1
+1 -1
View File
@@ -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_;