Palm‘s new software development kit for its WebOS, Mojo, includes the complete library for developing WebOS applications, as well an emulator that runs under Sun VirtualBox. The SDK also includes a plug-in for Eclipse so you can do all your development right within the Eclipse SDK.
Like many Eclipse plug-ins, the Mojo plug-in is easy to install and use. If you’re familiar with Web development, you’ll feel right at home creating HTML and JavaScript files. In addition, the Eclipse IDE (integrated development environment) has full support for editing HTML, JavaScript and CSS files, which makes development a snap.
Of course, the downside (and this is due to the SDK itself, not the Eclipse plug-in) is that you can’t write native, compiled applications in C or C++ as you could with earlier Palm products. For some developers, this could be a problem. The WebOS SDK does include a complete library for accessing the hardware, going well beyond what you could normally do in a Web application. But there’s still the issue of speed and, more importantly, graphics (which limits the creation of games).
In general, however, with the help of the Eclipse plug-in, you can easily get started writing WebOS applications.
For screenshots of Palm’s Mojo in action, click here.
Installing the Eclipse plug-in is easy with the Install feature within Eclipse. Once the plug-in is installed, the IDE has several wizards to help in your WebOS development.
During tests, I created a new WebOS project by simply choosing Palm WebOS -> Mojo Application from the New Project wizard. The wizard asked for the project name, a separate title for the project, a vendor name, and an ID and version.
The ID is the name of the class. Although the code is in JavaScript, you use Java naming conventions. A default ID of com.vendorname.projectitle is created. In my case, it was com.ziffdavisenterprise.mojoapp1.
Clicking Finish will create all the basic files for a new WebOS project.
A WebOS project is Web-based. In other words, the application runs in a browser within WebOS (which, at heart, is Linux-based). Applications consist of various HTML files, JavaScript files and style sheets. The files are organized in a fixed tree structure, with directories such as app (which contains the HTML and JavaScript files), images and style sheets.
Applications are organized into what are called scenes. A scene is essentially a single HTML file and an accompanying JavaScript file. The JavaScript files are called assistants, and they include the JavaScript code accompanying the HTML file in the form of a single object and its prototype methods.
To help developers create scenes in Eclipse, the plug-in includes a wizard that automatically creates the skeleton files. During tests, I just right-clicked on my project in the Project Explorer and chose New -> Mojo Scene. A pop-up box asked for the name of the scene (such as FirstScene). Then the plug-in created the basic files. The JavaScript file includes a constructor function as well as several prototype methods that are event handlers for various scene-level events (such as activate, deactivate and cleanup).
Because the applications are browser-based, they can be created as you would a typical Web application-by building HTML complete with DIV tags and style sheets. The WebOS includes a standard style sheet that provides a uniform look and feel across applications, as well as a whole set of controls that go beyond what’s normally available in a Web application. These controls are called widgets, and include buttons, menus and dialog boxes. The built-in libraries include full APIs for accessing and controlling the widgets.
The WebOS plug-in is supposed to officially work with Version 3.4.2 of Eclipse (code-named Ganymede). However, I was able to successfully run it on Version 3.5 of Eclipse (code-named Galileo) without any problems.
For more information on installing the Eclipse plug-in, click here.