Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Phonegap Essentials

You're reading from   Phonegap Essentials Use PhoneGap to build cross-platform mobile applications quickly and efficiently

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781785284687
Length 178 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ivan Turkovic Ivan Turkovic
Author Profile Icon Ivan Turkovic
Ivan Turkovic
Arrow right icon
View More author details
Toc

Core PhoneGap events


The latest version of PhoneGap doesn't come with any plugins installed by default so we can completely customize it for our needs; however, it does still come with a few events that are useful for making an initial hybrid mobile application. These basics are needed for properly managing the workflow of the application. We will examine the events that all major platforms support.

The deviceready event

This event is a must-have if you want to be able to use PhoneGap's functionality or any other plugin. The deviceready event is invoked when PhoneGap and all related resources are loaded and ready to be used.

Let's have a look at the example code:

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    // Now safe to use PhoneGap's APIs
}

The pause event

The pause event is triggered when the native platform puts the application into the background, for various reasons such as closing the application to go into the home screen or switching...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image