构造PhoneGap jQuery移动应用程序 [英] Structuring a PhoneGap jQuery Mobile Application
问题描述
我目前正在使用jQuery Mobile框架工作在phonegap构建一个游戏。我最终得到的是许多意粉代码与一个html和几个js类。
I am currently building a game in phonegap using jQuery Mobile frame work. What i have ended up with is lots of spaghetti code with one html and several js classes.
我有兴趣知道是否有任何好的指南来创建一个结构化的jQuery
I was interested to know if there are any good guides to create a structured jQuery Mobile Application that follows MVC pattern.
我发现一个良好的指南创建与Sencha触摸的MVC应用程序。我在寻找类似jQuery Mobile的东西。
I found a good guide for creating a MVC App with Sencha Touch. I was looking for something similar with jQuery Mobile.
推荐答案
我有一个相当大的应用程序, / p>
I have a rather large application and this is how I have it structured
css
-- all css files
images
-- all image files
js
controller.js -- page events and element actions. Also contains PhoneGap specific methods
core
forms.js -- working with forms, saving info
mobile.js -- basic definitions, AJAX communications
encrypt.js -- encryption
global.js -- helper functions
storage.js -- database storage wrapper
cw
client.js -- a client object, > 400 lines of js code
Objects.js -- all other needed objects with <50 lines of js code each
question.js -- a question object, > 500 lines of js code
service.js -- a service object, > 700 lines of js code
jq
jquery-ui.min.js
jquery.min.js
jquery.mobile.min.js
phonegap-1.1.0.js
add_client.html
clients.html
client_list.html
index.html -- the only file that is structured like a real full html file
manager.html
schedule.html
service.html
旁边我的index.html文件,所有其他.html文件是存根。它们只包含定义页面及其预期功能的< div data-role ='page'>< / div>
和其他所需的html元素。
aside for my index.html file, all other .html files are stubs. They only contain the <div data-role='page'></div>
and other needed html elements that define the page and its intended functionality.
我在VS2010上开发应用程序,使用Chrome作为我的调试器。当我感觉良好的进度,我将所有的东西复制到我的mac到一个Eclipse项目中的文件夹(对于Android设备),这也是我的xCode项目(iOS设备)的链接引用。
I develop the app on VS2010, using Chrome as my debugger. When I feel good with my progress, I copy everything over to my mac to a folder in an Eclipse project ( for Android devices ) which is also a linked reference in my xCode project ( for iOS devices ).
我已经在这个项目上工作了大约3-4个月了,一旦我超越了jQM和PhoneGap的学习曲线,在这个结构上取得了非常好的进展。
I have been working on this project for about 3-4 months now and once I got past the learning curve of jQM and PhoneGap, have been making very good progress with this structure.
这篇关于构造PhoneGap jQuery移动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!