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

Covering Promises and Q.js


As we said before, there's simply got to be a better way to deal with the callback hell that the File API has caused us to suffer. There is, but it takes a little bit of work to get there. For very simple operations, it might not always be worth it, but when you need to chain many operations together, having Promises really pays off.

Getting on with it

You've seen a glimpse of what callback hell looks like. It can get far, far worse. If you'll pardon the pun, Promises promise to alleviate the headache.

For the low-down on this, you might want to take a look at the Promises/A+ specification at http://promises-aplus.github.io/promises-spec/. Note that it doesn't provide any code; the specification leaves it up to other libraries to implement the specification. Q.js is but one; there are many others you can use. Generally, as long as they indicate they implement the specification, they can all be used in very similar ways (though each may have their own additional features...