我目前正在使用jQuery Mobile框架和phonegap构建一个游戏。但是,我最终得到的是一个HTML文件和几个JS类的混乱代码。
我想知道是否有任何好的指南可以创建遵循MVC模式的结构化jQuery Mobile应用程序。
我找到了一份关于使用Sencha Touch创建MVC应用程序的好指南。我正在寻找类似的适用于jQuery Mobile的指南。
我目前正在使用jQuery Mobile框架和phonegap构建一个游戏。但是,我最终得到的是一个HTML文件和几个JS类的混乱代码。
我想知道是否有任何好的指南可以创建遵循MVC模式的结构化jQuery Mobile应用程序。
我找到了一份关于使用Sencha Touch创建MVC应用程序的好指南。我正在寻找类似的适用于jQuery Mobile的指南。
我有一个相当大的程序,这是我的结构:
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元素。
我使用Chrome作为调试器,在VS2010上开发应用程序。当我对自己的进展感到满意时,我将所有内容复制到一个Eclipse项目中的文件夹(用于Android设备),该项目还是我的xCode项目(用于iOS设备)中的链接引用。
我已经在这个项目上工作了大约3-4个月,一旦我克服了jQM和PhoneGap的学习曲线,就可以非常好地使用这种结构进行进展。