我需要使用在 OpenLayers 3 中未标记为 @api
的方法,即它未在 OpenLayers 3 版本附带的默认最小化构建中导出。有问题的方法是: getTileCoordExtent
,属于 ol.tilegrid.TileGrid
类。
我尝试按照 configuration documentation 中的建议在构建 json 配置中添加 "ol.tilegrid.TileGrid#getTileCoordExtent"
,但出现以下错误:
ERR! No matching symbol found: ol.tilegrid.TileGrid#getTileCoordExtent
这是否意味着不能导出未标记为 @api
的方法?除了编辑代码并自己添加 @api
之外,还有什么方法可以完成我正在尝试做的事情吗?
最佳答案
借用Andreas Hocevar的回应:
The exports are determined by tasks/generate-exports.js reading symbols from build/info,json. If you want custom symbols, you can add them to the
symbols
object in info.json, e.g.
{
"symbols": [
{
"name": "ol.tilegrid.TileGrid#getTileCoordExtent",
}
]
}
Of course you should not be doing that, unless you are aware that you have no guarantee that what you add this way will be stable.
原始答案:https://groups.google.com/forum/#!msg/ol3-dev/HwWRoJF0eRU/MYvEa6-aAwAJ
关于openlayers-3 - 如何在 ol3 的自定义构建中包含非 API 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33132837/