Wednesday, August 11, 2010

Know Your SDK: The Mojo Framework Source | Palm Developer Center Blog

Know Your SDK: The Mojo Framework Source | Palm Developer Center Blog





You 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.
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.
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.
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.

  
Enhanced by Zemanta

No comments:

Post a Comment

[Invitation] Galaxy Unpacked 2024, Jan 17: Opening a New Era of Mobile AI.

A revolutionary mobile experience is coming. Get ready to discover a new era full of possibilities with the latest Galaxy innovations, desig...

Popular Posts