为 EaselJS 生成 Haxe extern
作为 JavaScript 和 Haxe 的新手,这可能有一个简单的答案,但我发现 Haxe 在 GoogleCode 上有 EaselJS 的 externs 端口,但它们已经过时并对应于早期版本。我已经能够修复编译时发生的错误,但我仍然担心我没有捕获所有新变量和函数名称。
我的问题是:有没有一种简单的方法来为像 EaselJS 这样的大型 JS 库生成外部程序?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能想看看 Joshua Granick 使用 BuildJS 所做的工作:
http://www.joshuagranick.com/blog/2011/10/14/use-buildjs-to-make-externs-for-haxe-js-automatically/
基本上有一个工具名为 JSDuck,它应该编译 JavaScript 库的文档,并且可以输出为 JSON。他使用 JSON 的输出,结合他的“buildjs”库来构建 haxe extern。
他将其用于 Sencha Touch,我将其用于 ExtJS,但这两者都是 Sencha 产品,并且众所周知,它们的编码风格可与 JSDuck 配合使用。您可以使用 EaselJS 尝试一下,如果它有效,那么 BuildJS 应该会生成非常准确的外部文件。
否则,您可以尝试找到原始 EaselJS extern 的作者,看看他们是否可以提供更新,或者帮助您创建准确的更新。您可以使用邮件列表或 Google 群组轻松联系大多数 haxe 开发人员:
http:// /groups.google.com/group/haxelang?hl=zh-CN
You might want to take a look at Joshua Granick's work with BuildJS:
http://www.joshuagranick.com/blog/2011/10/14/use-buildjs-to-make-externs-for-haxe-js-automatically/
Basically there's a tool called JSDuck which is supposed to compile documentation for JavaScript libraries, and it can output to JSON. He's used the output from JSON, combined with his "buildjs" library to build haxe externs.
He's used it for Sencha Touch, and I've used it for ExtJS, but both of those are Sencha products and their coding style is known to work with JSDuck. You can give it a go with EaselJS, if it works then BuildJS should generate pretty accurate externs.
Otherwise, you might try find the author of the original EaselJS externs and see if they can provide an update, or give you help creating an accurate update. Most of the haxe developers you can contact easily enough using the mailing list or google groups:
http://groups.google.com/group/haxelang?hl=en
我的答案有点晚了,但您可以在这里找到 EaselJs 的最新(v0.5.0)外部:
https: //github.com/Fintan/easelhx
我使用 BuildHx (https://github.com/jgranick/buildhx) 生成它们,它现在能够解析 YUIDoc 注释,然后通过移植来测试它们EaselJs 源附带的一些代码示例。
I'm a bit late with the answer but you can find the latest (v0.5.0) externs for EaselJs here:
https://github.com/Fintan/easelhx
I generated them using BuildHx (https://github.com/jgranick/buildhx) which is now able to parse YUIDoc comments and then tested them by porting some of the code samples that accompany the EaselJs source.
是的,我确实尝试安装 Joshua 的工具,但我遇到了 JSDuck 的问题。
在您链接到的示例中,JSDuck 应该有一个 --json 参数,但最新版本似乎已弃用该参数。我正在尝试其他一些使用配置文件的方法:
但这不起作用。无论我尝试什么,指南参数似乎都会失败。
创建 json 文件给了我这个输出:
所以我不知道下一步该做什么。如果能让很多图书馆都能使用这个功能那就太好了。
顺便说一下,我使用的是最新的 JSDuck 和 Windows 7。
Right, I did try and install Joshua's tool, but I'm running into an issue with JSDuck.
In the example you linked to, JSDuck is supposed to have a --json param, but the latest version seems to have deprecated that. I'm trying some others using the config file:
But that doesn't work. The guides param seems to fail no matter what I try.
Creating the json file gives me this ouput:
So I'm not sure what to do next. It'd be great to get this working for lots of libraries.
By the way, I'm using the latest JSDuck and Windows 7.