我想知道哪些语言和工具(调试器,IDE,分析器,库等)可供那些想要为Palm Pre开发的人使用。
另外,我想知道必须注意哪些技术限制。
答案 0 :(得分:3)
有一个JavaScript函数库,用于与基本系统(电话级别的东西)和CSS标签,样式等进行交互,以便以Palm WebOS样式进行渲染。
SDK附带了一个脚本“palm-generate”,它构建了一组配置文件和文件夹结构。 “palm-package”脚本构建了一个isntaller,而另一个脚本,“palm-install”将安装程序加载到模拟器的文件系统中(或者真正的掌上电脑,我相信......我的订单已经订购,应该在星期一! !)。
找到这段代码很容易,而且它完全不是原创代码,但我认为在这里瞥见是很有价值的......
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 / assistantants / 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 / assistantants / 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 / assistantants / 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));
}
答案 1 :(得分:2)
它非常像编写Web应用程序,但您需要从http://developer.palm.com/和掌上电脑模拟器下载webOS SDK。
所有信息都在那里,如果您使用eclipse IDE
,它很容易实现答案 2 :(得分:1)
这是一个基于Web的操作系统,所以我认为它与PhoneGap开发有点相似,如果你对它们的框架都熟悉的话。
使用自定义API调用的Javascript将驱动大多数应用程序,看起来他们正在配置他们的SDK以便与Eclipse IDE一起使用。当然,HTML和CSS将涵盖事物的前端。
可以在此处找到一个很好的初学者页面,说明您要查找的内容:http://developer.palm.com/index.php?option=com_content&view=article&id=1603