Book Image

PhoneGap 3.x Mobile Application Development HOTSHOT

By : Kerri Shotts
Book Image

PhoneGap 3.x Mobile Application Development HOTSHOT

By: Kerri Shotts

Overview of this book

<p>PhoneGap allows you to use your existing knowledge of HTML, CSS, and JavaScript to create useful and exciting mobile applications.<br /><br />This book will present you with 12 exciting projects that will introduce you to the dynamic world of app development in PhoneGap. Starting with their design and following through to their completion, you will develop real-world mobile applications. Each app uses a combination of core PhoneGap technologies, plugins, and various frameworks covering the necessary concepts you can use to create many more great apps for mobile devices.</p>
Table of Contents (21 chapters)
PhoneGap 3.x Mobile Application Development HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Putting it all together


We're almost there! We just need to put everything together with a couple of glue scripts, and then you can enjoy the app on your device!

Getting on with it

We need to define a few more short files to fill out the app, but once done, we'll have something that's ready to be built and deployed.

First, we need to define /www/js/app/main.js, as follows:

define ( ["yasmf", "app/views/noteListView"], function (_y, NoteListView ) {
   var APP = {};

Load the first view and initialize it (this will show the list of notes):

   APP.start = function () {

Find the rootContainer DOM element. YASMF always creates this for us, and it acts as the topmost element in the DOM hierarchy:

      var rootContainer = _y.ge("rootContainer");
      var noteListView = new NoteListView ();

Tell it to attach itself to the rootContainer element:

      noteListView.init( rootContainer );
      // store this for future reference
      APP.noteListView = noteListView;
   }
   return APP;
});

Next, define www...