Book Image

Mastering PhoneGap Mobile Application Development

By : Kerri Shotts
Book Image

Mastering PhoneGap Mobile Application Development

By: Kerri Shotts

Overview of this book

PhoneGap is a useful and flexible tool that enables you to create complex hybrid applications for mobile platforms. In addition to the core technology, there is a large and vibrant community that creates third-party plugins that can take your app to the next level. This book will guide you through the process of creating a complex data-driven hybrid mobile application using PhoneGap, web technologies, and third-party plugins. A good foundation is critical, so you will learn how to create a useful workflow to make development easier. From there, the next version of JavaScript (ES6) and the CSS pre-processor SASS are introduced as a way to simplify creating the look of the mobile application. Responsive design techniques are also covered, including the flexbox layout module. As many apps are data-driven, you'll build an application throughout the course of the book that relies upon IndexedDB and SQLite. You'll also download additional content and address how to handle in-app purchases. Furthermore, you’ll build your own customized plugins for your particular use case. When the app is complete, the book will guide you through the steps necessary to submit your app to the Google Play and Apple iTunes stores.
Table of Contents (19 chapters)
Mastering PhoneGap Mobile Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Storing objects


Storing objects is pretty simple, assuming you have appropriate error handlers at the database and transaction level. You can track events for each object you store; but this is a quick way to become overwhelmed if you're storing a lot of data.

Note

The snippets in this section are located at snippets/07/ex4-store-objects/* in the code package of this book. When using the interactive snippet playground, select 7: IndexedDB and the examples from 4a to 4b.

There are two ways you can store an object: you can add it or you can put it. Here are the differences between both methods:

  • add: This will store an object. The object must not already exist in the store. The object must satisfy any unique keys and indexes or an error will be generated.

  • put: This will store an object if the object doesn't exist and it will update an object if the object is already present in the store. The object must satisfy any unique keys and indexes or an error will be generated.

Once you have a readwrite...