jQuery Mobile Skeleton App

The skeleton on Windows Phone 7, iOS, and Android
Most modern IDEs include templates, a way to begin a new project without having to write all of the code from scratch. In order to speed up and standardize my jQuery Mobile development, I created a skeleton. The skeleton serves the same purpose as a template for my own projects.

There isn't anything difficult going on with the skeleton, but I will walk you through the application anyways to make sure that you understand everything.

The Files

First, I should explain the files which are included in the project. At the base of things are jQuery and jQuery Mobile core files. In a production app, I would normally get these files from a content delivery network CDN, but during development it helps to have the files local. 

Next, we have the app.js file. This is my application's core file. It contains the Kernel, which sends page events to their handler. And Events, which hooks all of the page events and feeds them to the Kernel. The last part of the file are the two page handler functions. 
The skeleton app's files

The final JavaScript file is the hideAddressBar.js. I am not completely in love with this solution the Android address bar problem, but it mostly works. Every time we receive a "pageinit" event we call the hideAddressBar function.

The HTML files should be nothing surprising so there is no real need to explain them except for the attribute, data-rockncoder-jspage="page2". This attribute is used to join the HTML to its corresponding JavaScript object. The Kernel uses it to determine the name of the JavaScript object and call the appropriate page event handler if it exists.

I hope this code helps you to write something cool. If it does drop me a line and an URL. 




Popular Posts