After loading the html page, the cordova will immediately call onDeviceReady event handle, so it is hard to set break pointer to debug the logic in onDeviceReady event.
One option is use javascript setInterval method, so it will hold the javascript until you change the bWait flag from javascript console window
The sample code looks like
One option is use javascript setInterval method, so it will hold the javascript until you change the bWait flag from javascript console window
The sample code looks like
var onDeviceReady = function() {
var originThis = this;
var bWait = true;
var bDone =false;
var i = 0
var i = 0
var timer = setInterval(
function(){
if (bWait && i < 10 ){
i++;
i++;
console.log("set bWait to false from console window to continue");
}
else{
if (!bDone){
bDone = true;
clearInterval(timer);
yourOriginalOnDeviceReady.apply(originThis, arguments);
}
}
}, 3000);
}
Actually, this can also be used in other cases for attaching javascript debugger, particularly for the js script loaded into the DOM at runtime by xhr request. Just wrap the original function with the above function should do it.