openlayers-3 - 如何在 ol3 的自定义构建中包含非 API 方法?

标签 openlayers-3 google-closure-compiler google-closure

我需要使用在 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/

相关文章:

openlayers-3 - Openlayers 3偏移正则形状

openlayers - 在开放层中标记轮廓3.17.1

google-closure-compiler - Google Closure 开源项目的 future

javascript - 关闭编译器键入 : Refer to function (factory method)

javascript - 关闭编译器删除类 namespace

javascript - Openlayers 3 获取谷歌地图基础层?

javascript - openLayers map 未定义错误

javascript - Make Closure Compiler strip 日志函数用法

JavaScript Closure - 监听类中所有元素的事件

google-closure-compiler - 我如何使用closurebuilder来编译和缩小脚本