6

我想知道那些想要为 Palm Pre 开发的人可以使用哪些语言和工具(调试器、IDE、分析器、库等)。

另外,我想知道存在哪些必须注意的技术限制。

4

3 回答 3

3

有一个 JavaScript 函数库,用于与基本系统(电话级别的东西)和 CSS 标记、样式等交互,用于以 Palm WebOS 样式呈现。

SDK 附带一个脚本“palm-generate”,它构建了一组配置文件和文件夹结构。“palm-package”脚本构建了一个安装程序,而另一个脚本“palm-install”将安装程序加载到模拟器的文件系统中(或者一个真正的手掌,我相信......我的已经订购了,应该在星期一在这里!! !)。

找到这段代码很容易,而且它根本不是原创的,但我认为在这里瞥一眼会很有价值......

Hello World - 复制自 palm webos sdk 中的教程

替代文字

HelloWorld/appinfo.json - 此应用程序的元信息,包括唯一名称(域样式)和应用程序的根(“index.html”)

{
    "id": "com.yourdomain.hello",
    "title": "Hello World",
    "type": "web",
    "main": "index.html",
    "icon": "icon.png",
    "version": "1.0.0",
    "vendor": "Your Company"
}

HelloWorld/sources.json - 清单

[
    {
        "source": "app\/assistants\/stage-assistant.js"
    },

    {
        "source": "app\/assistants\/first-assistant.js",
        "scenes": "first"
    }
]

helloWorld/app/assistants/stage-assistant.js - 应用程序的控制器。每个应用程序由一个包含多个场景的舞台组成;StageAssistant.setup() 方法首先获得控制权,为初始化数据、连接等提供时间。

function StageAssistant () {
}

StageAssistant.prototype.setup = function() {
    this.controller.pushScene('first');

}

HelloWorld/index.html - 舞台的视图

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPECTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <title>Hello, World!</title>
    <script src="/usr/palm/frameworks/mojo/mojo.js" type="text/javascript" x-mojo-version="1"></script>
</head>

<body>
Hello, World! 2:59
</body>
</html>  

helloWorld/app/assistants/first-assistant.js - “第一个”场景的视图

<div id="main" class="palm-hasheader">
    <div class="palm-header">Header</div>
    <div id="count" class="palm-body-text">count</div>
    <div id="MyButton" name="MyButton1" x-mojo-element="Button"></div>
</div>

helloWorld/app/assistants/first-assistant.js - “第一个”场景的控制器

function FirstAssistant() {
    /* this is the creator function for your scene assistant object. It will be passed all the 
       additional parameters (after the scene name) that were passed to pushScene. The reference
       to the scene controller (this.controller) has not be established yet, so any initialization
       that needs the scene controller should be done in the setup function below. */
}
FirstAssistant.prototype.handleButtonPress = function(event){
// increment the total and update the display
    this.total++;
    this.controller.get('count').update(this.total);
}
FirstAssistant.prototype.setup = function() {
    /* this function is for setup tasks that have to happen when the scene is first created */

    /* use Mojo.View.render to render view templates and add them to the scene, if needed. */

    /* setup widgets here */

    /* add event handlers to listen to events from widgets */
// set the initial total and display it
    this.total=0;
    this.controller.get('count').update(this.total);


// a local object for button attributes
    this.buttonAttributes = {};

// a local object for button model
    this.buttonModel = {
        buttonLabel : 'TAP HERE',
        buttonClass : '',
        disabled : false
        };


// set up the button
    this.controller.setupWidget("MyButton", this.buttonAttributes, this.buttonModel);
// bind the button to its handler
    Mojo.Event.listen(this.controller.get('MyButton'), Mojo.Event.tap, this.handleButtonPress.bind(this));
}

FirstAssistant.prototype.activate = function(event) {
    /* put in event handlers here that should only be in effect when this scene is active. For
       example, key handlers that are observing the document */
}


FirstAssistant.prototype.deactivate = function(event) {
    /* remove any event handlers you added in activate and do any other cleanup that should happen before
       this scene is popped or another scene is pushed on top */
}

FirstAssistant.prototype.cleanup = function(event) {
    /* this function should do any cleanup needed before the scene is destroyed as 
       a result of being popped off the scene stack */
      this.controller.stopListening(this.controller.get('MyButton'), Mojo.Event.tap, this.handleButtonPress.bind(this));
}
于 2009-07-17T22:58:37.150 回答
2

它非常类似于编写 Web 应用程序,但您需要从http://developer.palm.com/和掌上模拟器下载 webOS SDK。

如果您使用 Eclipse IDE,所有信息都在那里并且很容易上手

于 2009-07-16T20:05:09.417 回答
1

它是一个基于 Web 的操作系统,所以我认为它有点类似于进行 PhoneGap 开发,如果你完全熟悉他们的框架的话。

带有自定义 API 调用的 Javascript 将驱动大多数应用程序,看起来他们正在配置他们的 SDK 以与 Eclipse IDE 一起工作。当然 HTML 和 CSS 将涵盖事物的前端。

可以在这里找到一个很好的初学者页面来解释您正在寻找的内容:http: //developer.palm.com/index.php ?option=com_content&view=article&id=1603

于 2009-07-16T23:56:35.970 回答