既然Palm Pre SDK已经推出,那么为该手机开发需要什么?

Dan*_*ral 6 palm-pre

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

此外,我想知道人们必须注意哪些技术限制.

Mar*_*aff 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"
}
Run Code Online (Sandbox Code Playgroud)

HelloWorld/sources.json - 清单

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

    {
        "source": "app\/assistants\/first-assistant.js",
        "scenes": "first"
    }
]
Run Code Online (Sandbox Code Playgroud)

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

function StageAssistant () {
}

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

}
Run Code Online (Sandbox Code Playgroud)

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>  
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

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));
}
Run Code Online (Sandbox Code Playgroud)