找回密码
 加入我们

扫一扫,访问微社区

QQ登录

只需一步,快速开始

搜索
查看: 2226|回复: 1

[webOS开发] 转载自PDCB: Know your SDK: The Mojo Framework Source

[复制链接]
发表于 2010-8-11 10:26 | 显示全部楼层 |阅读模式
前面讲了1.4.5 SDK的各个部分所在位置。后面我觉得将挺实在的,作者推荐仔细阅读一些源码,这样有助于提高对Mojo框架的理解,作者更推荐在webOS范围内随意使用源码,当然,要遵循SDK license的。
8 ~2 [, Y! R( T" U# t5 K/ Y; @
  K& Q3 y5 X* nYou may not realize it, but if you have the webOS SDK installed on your system, you’ve got the source for the Mojo framework there right on your machine available for reading. On Windows, we install it in the “share/refcode/webos-framework” folder under the location where the SDK lives (usually c:\Program Files\Palm\SDK), next to the code samples and webOS application source. On Mac, it’s in /opt/PalmSDK/share/refcode/framework.
# o' g) a; M; C+ a( `4 f! ^, H3 e/ p, Z) w0 }6 L
In this folder, you’ll first find another folder with a number. In the 1.4.5 SDK, that’s 337, and it matches an internal “submission” number we use to control what version of the framework ships on the device. In that folder, most of the actual source code is in the “javascripts” folder, but the version of Prototype we use is in the “builtins” folder. The “templates” folder holds HTML template files used in building the widgets in the system, “stylesheets” holds the CSS files used by the system, and “resources” and “formats” have JSON that’s used to handle our various locales.
# ~  q* N" g% K  Y" Q3 M' H2 p5 W6 _' q; \7 i
Reading the framework source can be a bit daunting, but it’s been invaluable for me in understanding how Mojo works. It also can be a great place to look to see how parameters that you pass into calls are actually used and how the various JavaScript objects are put together. Some of the classes, like Mojo.Controller.SceneController, have some useful properties (e.g. sceneName, stageController and window) that are used in our sample code but are currently missing from our documentation — we’re working on filling these gaps now. (However, don’t rely on any properties or methods that start with an underscore, as that’s a signal that the data is for internal-use-only.) There are some useful comments, but as with a lot of code, the comments sometimes have aged more than the code they describe, so reading the code is essential for knowing things like when you can omit an argument.5 X7 p5 e* X3 s0 \1 ?: D
5 ~* N9 Z4 `0 M2 V: d: }
So, I encourage you to dive in and explore the framework source, along with the source for many of our Palm apps, which you’ll also find installed with the SDK. A quick note on licensing: use of the framework and app source code is governed by the terms of the SDK license agreement, which is permissive but not open-source. You’re free to explore the code, learn from it, and even reuse it, as long as you’re working on webOS applications—the license currently does not allow use outside of webOS.
回复

使用道具 举报

发表于 2010-8-11 18:13 | 显示全部楼层
谢谢分享
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

QQ|Archiver|手机版|小黑屋|吹友吧 ( 京ICP备05078561号 )

GMT+8, 2024-2-23 07:36 , Processed in 0.199449 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表