O'Reilly logo

Beginning PhoneGap by Thomas Myer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix C

PhoneGap.js

Following is the code contained within the PhoneGap.js file:

/* * PhoneGap is available under *either* the terms of the modified BSD license * *or* the * MIT License (2008). * See http://opensource.org/licenses/alphabetical for full text. * * Copyright (c) 2005-2010, Nitobi Software Inc. * Copyright (c) 2010-2011, IBM Corporation */ if (typeof PhoneGap === "undefined") { /** * The order of events during page load and PhoneGap startup is as follows: * * onDOMContentLoaded Internal event that is received when the web page * is loaded and parsed. * window.onload Body onload event. * onNativeReady Internal event that indicates the PhoneGap native * side is ready. * onPhoneGapInit Internal event that kicks off creation of all * PhoneGap JavaScript objects (runs constructors). * onPhoneGapReady Internal event fired when all PhoneGap JavaScript * objects have been created * onPhoneGapInfoReady Internal event fired when device properties are * available * onDeviceReady User event fired to indicate that PhoneGap is * ready * onResume User event fired to indicate a start/resume * lifecycle event * onPause User event fired to indicate a pause lifecycle * event * onDestroy Internal event fired when app is being destroyed * (User should use window.onunload event, * not this one). * * The only PhoneGap events that user code should register for are: * onDeviceReady * onResume * * Listeners can be registered as: * document.addEventListener("deviceready", myDeviceReadyListener, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required