gpt4 book ai didi

palm-pre - 现在 Palm Pre SDK 已经出来了,为那部手机开发需要什么?

转载 作者:行者123 更新时间:2023-12-04 15:05:33 27 4
gpt4 key购买 nike

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

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

最佳答案

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

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

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

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

alt text

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 - 应用程序的 Controller 。每个应用程序由一个带有多个场景的舞台组成; StageAssistant.setup() 方法首先获得控制权,为初始化数据、连接等提供时间。
function StageAssistant () {
}

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

}

HelloWorld/index.html - 舞台 View
<?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 - “第一个”场景的 Controller
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));
}

关于palm-pre - 现在 Palm Pre SDK 已经出来了,为那部手机开发需要什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1139787/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com