Hi,
I'm a new user of Kendo UI and i have trouble to understand the lifecycle of the application with Cordova.
Here, i would like to do different actions if the user is online or offline (redirect, show different content, ...).
I can't put the code in the app.Bootstrap.show() method because the variable navigator.connection is initialized only after the deviceReady event is fired.
I try with the after-show event but that's the same : the event is fired before the deviceReady event.
How can i do this ?
Thanks a lot for your help,
Antoine.
app.js :
bootstap.js :
I'm a new user of Kendo UI and i have trouble to understand the lifecycle of the application with Cordova.
Here, i would like to do different actions if the user is online or offline (redirect, show different content, ...).
I can't put the code in the app.Bootstrap.show() method because the variable navigator.connection is initialized only after the deviceReady event is fired.
I try with the after-show event but that's the same : the event is fired before the deviceReady event.
How can i do this ?
Thanks a lot for your help,
Antoine.
app.js :
var app = (function (win) { 'use strict'; var onDeviceReady = function() { //Do some stuff }; // Handle "deviceready" event document.addEventListener('deviceready', onDeviceReady, false); // Initialize KendoUI mobile application var mobileApp = new kendo.mobile.Application(document.body, { transition: 'slide', skin: 'flat', initial: 'bootstrap' }); return { mobileApp: mobileApp }; }(window));bootstap.js :
var app = app || {};app.Bootstrap = (function () { 'use strict' var bootstrapViewModel = (function () { var show = function (e) { // Check if user is online and do some stuff
// By accessing navigator.connection }; return { show: show }; }()); return bootstrapViewModel; }());<body> <!--Home--> <div id="bootstrap" data-role="view" data-show="app.Bootstrap.show"> <div class="view-content"> <h1>My app</h1> <div class="content"></div> </div> </div> ....</body>