From 2879c0b6ad9202b70e8ac1d6fa8865c60b2e4fb0 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 7 Feb 2019 11:51:28 +0100 Subject: [PATCH] Remove opt_this param in forDataAtCoordinate function --- src/ol/source/UTFGrid.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ol/source/UTFGrid.js b/src/ol/source/UTFGrid.js index 6f90ab454c..521151f494 100644 --- a/src/ol/source/UTFGrid.js +++ b/src/ol/source/UTFGrid.js @@ -138,25 +138,23 @@ export class CustomTile extends Tile { * Calls the callback (synchronously by default) with the available data * for given coordinate (or `null` if not yet loaded). * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. - * @param {function(this: T, *): void} callback Callback. - * @param {T=} opt_this The object to use as `this` in the callback. + * @param {function(*): void} callback Callback. * @param {boolean=} opt_request If `true` the callback is always async. * The tile data is requested if not yet loaded. - * @template T */ - forDataAtCoordinate(coordinate, callback, opt_this, opt_request) { + forDataAtCoordinate(coordinate, callback, opt_request) { if (this.state == TileState.IDLE && opt_request === true) { listenOnce(this, EventType.CHANGE, function(e) { - callback.call(opt_this, this.getData(coordinate)); + callback(this.getData(coordinate)); }, this); this.loadInternal_(); } else { if (opt_request === true) { setTimeout(function() { - callback.call(opt_this, this.getData(coordinate)); + callback(this.getData(coordinate)); }.bind(this), 0); } else { - callback.call(opt_this, this.getData(coordinate)); + callback(this.getData(coordinate)); } } } @@ -391,7 +389,7 @@ class UTFGrid extends TileSource { coordinate, resolution); const tile = /** @type {!CustomTile} */(this.getTile( tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection())); - tile.forDataAtCoordinate(coordinate, callback, null, opt_request); + tile.forDataAtCoordinate(coordinate, callback, opt_request); } else { if (opt_request === true) { setTimeout(function() {