简体   繁体   中英

Need exact location of deviceready() in cordova.js

The below code returns me the cordova object. By using the object I am accessing cordava.js

<script>
    function onLoad()
        document.addEventListener("deviceready", onDeviceReady(cordova), false);
</script>

Now my query is, from the eventlistener it calls deviceready function. I am asking here where is deviceready function definition. Where can i find this.

onDeviceready is a callback function which tells you cordova is ready. So you should define it and write your code related with cordova inside it.

document.addEventListener("deviceready", onDeviceReady(cordova), false);

function onDeviceReady(cordova) {
 //your code goes here

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM