Here is the standard way of loading and detecting Cordova & JqueryMobile framework.
/*
@author Abhishek Kumar
@email akbittu@gmail.com
*/
var app = {
deviceReadyDeferred,
jqmReadyDeferred,
initialize: function() {
this.deviceReadyDeferred = $.Deferred();
this.jqmReadyDeferred = $.Deferred();
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
$(document).one("mobileinit", this.onJQMReady);
$.when(this.deviceReadyDeferred, this.jqmReadyDeferred).then(this.onCompleteReady);
},
onDeviceReady: function() {
app.deviceReadyDeferred.resolve();
},
onJQMReady: function() {
app.jqmReadyDeferred.resolve();
},
onCompleteReady: function() {
main();
}
};
Comments
Post a Comment