Update AppCache in background when toggling light and enabling docs inline

pull/168/head
Thibaut 10 years ago
parent 9a99e79fe9
commit 8de2dd607b

@ -102,6 +102,7 @@
@initDoc(doc)
@settings.setDocs(doc.slug for doc in @docs.all())
_onSuccess()
@appCache?.updateInBackground()
return
doc.load onSuccess, onError, writeCache: true

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

@ -23,6 +23,7 @@ class app.views.Document extends app.View
css.setAttribute('data-alt', css.getAttribute('href'))
css.setAttribute('href', alt)
app.settings.setDark(alt.indexOf('dark') > 0)
app.appCache?.updateInBackground()
return
setTitle: (title) ->

Loading…
Cancel
Save