Titanium Mobile 是否将 Javascript 转换为本机 Java 或 Objective C 编译代码?
我读了很多文章(我在下面列出),但我无法得到一致的答案。我们可以只选择以下两个答案之一吗?如果您为 Appcelerator 或任何竞争对手工作,请注明。谢谢!
仅供参考,我正在使用 Titanium Studio 1.7.2。
答)是的,它编译为本机代码,但某些代码必须保留在 Javascript 中并在运行时解释。
B) 不,这不是钛的工作原理。
以下是我读过的文章:
1)Corona、Phonegap、Titanium之间的比较
2) http://developer.appcelerator.com/blog/2010/12/titanium-guides-project-js-environment.html
I've read so many articles (which I listed below), but I can't get a consistent answer. We would it be possible to just pick one of the following 2 answers? If you work for Appcelerator or any competitor, please state so. Thanks!
FYI, I am working with Titanium Studio 1.7.2.
A) Yes it compiles to native code, but some of the code must be left in Javascript and interpreted at runtime.
B) No, that is not the way Titanium works.
Here are the articles, I have read:
1) Comparison between Corona, Phonegap, Titanium
2) http://developer.appcelerator.com/blog/2010/12/titanium-guides-project-js-environment.html
3) What happens to JavaScript code after app is compiled using Titanium Mobile
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Kevin Whinnery 在您提供的链接上的回复是准确的 “JavaScript 代码会发生什么——”。
简而言之:您的 JavaScript 在运行时运行(iOS 上的 JavaScriptCore,以及 Android 上的 Rhino,但很快是 V8)。您的 JavaScript 可以通过桥与本机代码和组件进行交互。像按钮、表格视图、网页视图、标签等。实际的 JavaScript 被编译到应用程序中并在设备上运行时运行。但这是一个非常简单的答案。要了解更多信息,请阅读上面链接中 Kevin 的回答。
这就是您如何通过两个平台上的本机组件的强大功能来获得 JavaScript 的强大功能。
我在 Appcelerator 工作。
Kevin Whinnery's response is accurate on the link you provided to "What happens to JavaScript code--".
To state it succinctly: your JavaScript runs in a runtime (JavaScriptCore on iOS, and Rhino but soon V8 on Android). Your JavaScript can interact over a bridge with native code and components. Like buttons, table views, web views, labels, etc. The actual JavaScript is compiled in to the app and run at runtime on the device. But this is a very simplistic answer. To learn more, please read Kevin's answer in the link above.
That's how you get the power of JavaScript with the power of the native components on both platforms.
I work for Appcelerator.
从表面上看(至少他们在网站和宣传片上发布的内容),他们有一个 Javascript API,该 API 被编译成 iPhone 或 Android 上的 Native 位(相应的 Objective C 和 Java,具体取决于操作系统)
From what it seems (what they publish on their website and promos at least) , they have a Javascript API thats being compiled into Native bits on iPhone or Android (Objective C and Java accordingly, depending on the OS)