找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 2238|回复: 1

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

[复制链接]
发表于 2010-8-11 10:26 | 显示全部楼层 |阅读模式
前面讲了1.4.5 SDK的各个部分所在位置。后面我觉得将挺实在的,作者推荐仔细阅读一些源码,这样有助于提高对Mojo框架的理解,作者更推荐在webOS范围内随意使用源码,当然,要遵循SDK license的。
0 M- ]5 O: N1 Y7 X) M9 b
* T) |% e3 ^) L4 q& |: @9 WYou 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.* ~) h2 W. L2 Z( d3 d- K

, `3 T+ i$ x. p/ j" dIn 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.6 _, u3 J. ^/ c* ?. r+ q
4 x! X7 p% L( w$ a& T# O) R
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.+ O/ i, o8 S4 Q$ a  E0 ?

% c$ L& g9 ?% s1 p5 J' bSo, 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-7-27 14:09 , Processed in 0.275446 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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