Developing With Enyo

From WebOS101

Revision as of 07:17, 20 November 2011 by Eblade (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Developing and Debugging With Enyo

Documentation

The official Enyo documentation is here: https://developer.palm.com/content/api/dev-guide/enyo.html

Starting a Project

Starting with webOS SDK 3.0.4, you can use the "palm-generate" command to generate enyo templates. See the "palm-generate --help" command for details.

Older way

Enyo does not have a palm-generate template associated with it. Your best bet is to copy the structure of one of the sample applications, such as the Hello World project, and edit it to suit your purposes. On Linux this can be found at:

/opt/PalmSDK/0.1/share/refcode/framework/enyo/1.0/support/examples/HelloWorld

Edit the appinfo.json file and change the id to match your company name and application name, change the vendor to match your company name, change the title to match your application name, and change the icon to match the icon file you will be using for your application. If you don't have an icon set, a crescent moon icon will be shown. You can also change which HTML file your application starts with by changing the value for main, with index.html being the default.

The depends.js file lists the code files that will be loaded and used in your project.

Local Development

Enyo applications can be developed on your PC using Linux, Windows, or MacOS and debugged/tested using Chrome (or Chromium). It needs to be run with the --allow-file-access-from-files command line parameter. For example, on Linux:

chromium-browser --allow-file-access-from-files index.html &

The Enyo JavaScript path in the main index file needs to point to where Enyo is on your local system. For example:

<script src="../../../../opt/PalmSDK/0.1/share/refcode/framework/enyo/1.0/framework/enyo.js" type="text/javascript"></script>

Don't worry that this does not match the location of Enyo on the device. The palm-package application will replace the path with the device's native Enyo file path.

On-Device Testing

Just like any other webOS application, you package the app with the palm-package command, install it with palm-install and follow log files with palm-log -f com.yourcompany.yourappname. A shortcut for this process is the palm-run command.

Personal tools