Events
Events
There are various events provided by cordova to be used by the application. The application code could add listeners for these events. For example:
HTML File
<!DOCTYPE html> <html> <head> <title>Device Ready Example</title> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8" src="example.js"></script> </head> <body onload="onLoad()"> </body> </html>
JS File
// example.js file // Wait for device API libraries to load // function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); } // device APIs are available // function onDeviceReady() { document.addEventListener("pause", onPause, false); document.addEventListener("resume", onResum