concept deviceready in category cordova

appears as: deviceready
Apache Cordova in Action

This is an excerpt from Manning's book Apache Cordova in Action.

First, there’s a critically important aspect of Cordova development that you need to learn. Before your application can talk to a plugin, Cordova has to set up a line of communication between your code and the device. That sounds complex, but it really isn’t. Basically, Cordova knows what it has to do on each supported platform to let plugin code access device hardware. All you have to do is wait for Cordova to finish. So how do you know when this has happened? All Cordova applications will fire an event called deviceready which can be listened to in your JavaScript code. So why did the real (but simple) application in chapter 3 work? Because you weren’t doing anything special. Listening to events in JavaScript is fairly simple.

Listing 4.1. deviceready example