|
@@ -14,13 +14,18 @@ class app.AppCache
|
|
|
$.on @cache, 'updateready', @onUpdateReady
|
|
$.on @cache, 'updateready', @onUpdateReady
|
|
|
|
|
|
|
|
update: ->
|
|
update: ->
|
|
|
|
|
+ @notifyUpdate = true
|
|
|
|
|
+ try @cache.update() catch
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ updateInBackground: ->
|
|
|
|
|
+ @notifyUpdate = false
|
|
|
try @cache.update() catch
|
|
try @cache.update() catch
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
reload: ->
|
|
reload: ->
|
|
|
- @reloading = true
|
|
|
|
|
$.on @cache, 'updateready noupdate error', -> window.location = '/'
|
|
$.on @cache, 'updateready noupdate error', -> window.location = '/'
|
|
|
- @update()
|
|
|
|
|
|
|
+ @updateInBackground()
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
onProgress: (event) =>
|
|
onProgress: (event) =>
|
|
@@ -28,5 +33,5 @@ class app.AppCache
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
onUpdateReady: =>
|
|
onUpdateReady: =>
|
|
|
- @trigger 'updateready' unless @reloading
|
|
|
|
|
|
|
+ @trigger 'updateready' if @notifyUpdate
|
|
|
return
|
|
return
|