[英]Input arguments to a JavaScript inline function
I'm reading this example snippet in googlemaps API. 我正在用googlemaps API阅读此示例代码段。
The below is an extract from the snippet. 以下是摘录的摘录。
getNormalizedCoord(coord, zoom)
is a separately defined function. getNormalizedCoord(coord, zoom)
是一个单独定义的函数。
The value of the getTileUrl
attribute is assigned to the output of the inline function which takes (coord, zoom)
as arguements. getTileUrl
属性的值分配给内联函数的输出,该内联函数将(coord, zoom)
作为参数。
var moonMapType = new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
var normalizedCoord = getNormalizedCoord(coord, zoom);
....
....
},
....
....
});
Question: What are the values of the coord, zoom
variables when they are called inside the inline function? 问题:在内联函数内部调用时,
coord, zoom
变量的值是什么?
I don't see them assigned to anything prior to calling them. 在给他们打电话之前,我没有看到他们被分配任何东西。
It's taking the parameters from getTileUrl which belongs to the ImageMapTypeOptions object specification. 它从属于ImageMapTypeOptions对象规范的getTileUrl获取参数。
getTileUrl
Type: function(Point, number): string
Returns a string (URL) for given tile coordinate (x, y) and zoom level.
https://developers.google.com/maps/documentation/javascript/3.exp/reference#ImageMapTypeOptions https://developers.google.com/maps/documentation/javascript/3.exp/reference#ImageMapTypeOptions
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.