简体   繁体   English

JavaScript回调中的冒号

[英]Colon in javascript callback

I'm using the data layer on google maps with point geometries that occasionally use the same coordinates. 我在Google地图上使用的数据层具有偶尔使用相同坐标的点几何形状。 To access all of the features at a given coordinate I'm trying to use a port of OverlappingMarkerSpiderfier for the data layer instead of markers called OverlappingFeatureSpiderfier . 为了在给定坐标下访问所有要素,我试图使用OverlappingMarkerSpiderfier端口作为数据层,而不是使用称为OverlappingFeatureSpiderfier的标记。

I'm have problems adding the click handler for the data layer. 我在为数据层添加点击处理程序时遇到问题。 In the documentation it calls for: 在文档中,它要求:

ofs.addListener("click", function(event: google.maps.Data.MouseEvent) {
  var theFeatureThatWasClicked = event.feature;
}

Besides the missing parenthesis, I can't figure out what's going on with that colon in the callback. 除了缺少括号外,我无法弄清楚回调中该冒号的情况。 Any ideas? 有任何想法吗?

The colon syntax there is a TypeScript type annotation. 冒号语法中有一个TypeScript类型注释。

To use that with vanilla JS, just put function(event) . 要将其与香草JS一起使用,只需放置function(event)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM