Tuesday, 18 October 2011

Introduction to Enyo Development for webOS

Getting started from Mojo to Enyo can be quite disappointing. Looking at the Tutorial from HP, it is pretty hard and despite searching over the internet, I couldn't start it until I have done an experiment myself. Hope this will help someone and please do give your comment or feedback.

From the beginning, I have generated a Basic Application called x3 from Eclipse. You can also do this using a plain text editor if you are not using any development tool.

This is the file structure of the completed x3 application. You will find the next steps in the next paragraph.





















Next I have taken the original index.html and replace it with the following code. Note: The folder containing enyo.js must be a folder in your computer and this is an example of the SDK installed on Debian. If you are using Windows or Mac, I am sure you can enter similar information. I have put mine as follow.
index.html:











Next, I had a look at appinfo.json and added a new row "uiRevision".
appinfo.json:
{
"id": "com.petkatandevelopment.x3",
"version": "1.0.0",
"vendor": "Petkatan Development",
"type": "web",
"main": "index.html",
"title": "x3",
"icon": "icon.png",
"uiRevision": 2
}

Then, I have created a new file called depends.js which will contain the following.
depends.js:
enyo.depends(
"x3.js"
);

In the x3.js, I just put a simple control which will be rendered at run-time, as follow.
x3.js:
enyo.kind({
name: "x3",
kind:enyo.Control,
content:"testing 123"
});


Once it is completed, I will then package the IPK for deployment to the TouchPad emulator. In the command-line, type the following:
palm-package /home/peter/workspace/x3

It will then generate com.petkatandevelopment.x3_1.0.0_all.ipk in my current folder.

Next, I will install the package to the emulator:
palm-install com.petkatandevelopment.x3_1.0.0_all.ipk

You will see a sample of the app in the emulator:











When you launch this x3 app, you will see the following:

5 comments:

  1. Did you use the webOS plugin for eclipse? If so did you use the webOS perspective when you loaded your files into the eclipse IDE?

    ReplyDelete
  2. Unfortunately, Eclipse is not supporting Enyo at the moment. So the only tool is text editor :'(

    ReplyDelete
  3. I've just come across your blog looking for Eclipse and Enyo. I was thinking about starting programming for webOS. Unfortunately I don't have any experience with any language. So I wonder if it's worth learning all this and how difficult it might be for someone who knows only HTML and CSS.

    ReplyDelete
  4. It is pretty hard to advise as webOS has come to a cross-road whereby the CEO will need to decide whether to continue with webOS.

    Personally speaking, I hope HP will continue with this amazing OS as it is pretty simple to code.

    On the other hand, it is pretty hard to find any documentation but, you can get sample codes when you install the SDK.

    If you know HTML and CSS, I am sure you will love it as it simplifies the way you code.

    Hope this helps.

    ReplyDelete
  5. Thanks Peter!
    I think I will try to learn Enyo. In the worst case I'll end up with learning JavaScript. ;)

    ReplyDelete