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

Transactions


All the interactions that read from or write to an object store must be performed within the context of a transaction are a mechanism that ensures data consistency. If any part of a transaction fails, all the actions that occurred during the transaction are reverted.

You can request a transaction from the database as follows:

let transaction = db.transaction(["store", ...], mode);

The first parameter to transact is the list of stores that you are going to use in the transaction. You have to specify these in advance to actually query or modify the data within.

The second parameter is optional. It specifies whether or not the transaction is simply reading data (readonly) or if the transaction needs to write data (readwrite). There is also a versionchange mode that you can use to make changes to store schemas, but you should only do this kind of operation during a database upgrade. If this parameter isn't supplied, readonly will be assumed.

A transaction will generate events, so you...