I have not done much testing... and I am concerned if the new version is not loaded then it could get into an infinite loop of trying to reload.
Code:
Ext.define('Dcs.override.app.Application', {
override: 'Ext.app.Application',
config: {
autoReload: false
},
onBeforeLaunch: function() {
if (this.getAutoReload() && Ext.Microloader && Ext.Microloader.appUpdate && Ext.Microloader.appUpdate.updated) {
window.location.reload();
} else {
this.callParent(arguments);
}
}
});
Then in your Application
remember when testing you have to reload twice after changing autoReload to true. The version on your browser cache will still have false and ask for a reload.
Code:
Ext.define('Checkout.Application', {
extend: 'Ext.app.Application',
autoReload: true,
// this will never be ran if autoReload is set to true.
// you don't need this function.
onAppUpdate: function () {
Ext.Msg.confirm('Application Update', 'This application has an update, reload?',
function (choice) {
if (choice === 'yes') {
window.location.reload();
}
}
);
}
// rest of your application.
}