Reload after update

This commit is contained in:
Ruud
2012-05-27 23:30:29 +02:00
parent 5a3919cb08
commit 767ad46d90
2 changed files with 8 additions and 11 deletions
@@ -82,10 +82,11 @@ var UpdaterBase = new Class({
'onComplete': function(json){
if(json.success){
App.restart('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating');
App.checkAvailable.delay(500, App);
App.checkAvailable.delay(500, App, [1000, function(){
window.location.reload();
}]);
if(self.message)
self.message.destroy();
window.location.reload();
}
}
});
+5 -9
View File
@@ -220,18 +220,21 @@ var CouchPotato = new Class({
self.checkAvailable(3000);
},
checkAvailable: function(delay){
checkAvailable: function(delay, onAvailable){
var self = this;
(function(){
Api.request('app.available', {
'onFailure': function(){
self.checkAvailable.delay(1000, self);
self.checkAvailable.delay(1000, self, [delay, onAvailable]);
self.fireEvent('unload');
},
'onSuccess': function(){
if(onAvailable)
onAvailable()
self.unBlockPage();
self.fireEvent('reload');
}
});
@@ -263,13 +266,6 @@ var CouchPotato = new Class({
createUrl: function(action, params){
return this.options.base_url + (action ? action+'/' : '') + (params ? '?'+Object.toQueryString(params) : '')
},
notify: function(options){
return this.growl.notify({
title: "this scrolls away",
text: "test - hello there. mouseover to pause away action"
});
}
});