Remove opt_this param in forDataAtCoordinate function

This commit is contained in:
Frederic Junod
2019-02-07 11:51:28 +01:00
parent 41d231a4c7
commit 2879c0b6ad

View File

@@ -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() {