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 add some styles, edit a couple of files with minor adjustments, and we'll be done!

Getting on with it

If you were to run the app now, it would work, but you wouldn't actually be able to create image notes, which defeats the purpose of what we've done so far. The reason the app fails is because we haven't updated our factories or our note list view.

In www/js/app/factories/noteFactory.js, we update the factory so that it can return an image note and an appropriate filename. Use the following code to update the factory:

define ( ["app/models/baseNote", "app/models/audioNote","app/models/imageNote"],
function ( BaseNote, AudioNote, ImageNote )
{

   noteFactory.createNote = function ( noteType ) {
   …
         case noteFactory.IMAGENOTE:
            return new ImageNote();
   …
   }

   noteFactory.createAssociatedMediaFileName = function (noteType, uid) {
   …
               case noteFactory.IMAGENOTE:
                 extension = {...