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, ...

Get Beginning PhoneGap now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.