History

Minor performance optimization to speed up app boot

Thibaut Courouble committed 9 years ago

Commit d59d43e1 parent 067fa933 files · +8 −5Browse files

Unified · Split

3 files
  1. assets/javascripts/app/app.coffee +4 −2
  2. assets/javascripts/app/update_checker.coffee +2 −2
  3. assets/javascripts/views/search/search.coffee +2 −1
assets/javascripts/app/app.coffee+4−2
@@ -105,8 +105,10 @@ · 104 unmodified lines
105 @trigger 'ready'105 @trigger 'ready'
106 @router.start()106 @router.start()
107 @hideLoading()107 @hideLoading()
108 @welcomeBack() unless @doc108 setTimeout =>
109 @removeEvent 'ready bootError'109 @welcomeBack() unless @doc
110 @removeEvent 'ready bootError'
111 , 50
110 return112 return
111 113
112 initDoc: (doc) ->114 initDoc: (doc) ->
assets/javascripts/app/update_checker.coffee+2−2
@@ -5,7 +5,7 @@ class app.UpdateChecker · 4 unmodified lines
5 $.on window, 'focus', @checkForUpdate5 $.on window, 'focus', @checkForUpdate
6 app.appCache.on 'updateready', @onUpdateReady if app.appCache6 app.appCache.on 'updateready', @onUpdateReady if app.appCache
7 7
8 @checkDocs()8 setTimeout @checkDocs, 0
9 9
10 check: ->10 check: ->
11 if app.appCache11 if app.appCache
@@ -21,7 +21,7 @@ class app.UpdateChecker · 9 unmodified lines
21 new app.views.Notif 'UpdateReady', autoHide: null21 new app.views.Notif 'UpdateReady', autoHide: null
22 return22 return
23 23
24 checkDocs: ->24 checkDocs: =>
25 unless app.settings.get('manualUpdate')25 unless app.settings.get('manualUpdate')
26 app.docs.updateInBackground()26 app.docs.updateInBackground()
27 else27 else
assets/javascripts/views/search/search.coffee+2−1
@@ -135,7 +135,8 @@ class app.views.Search extends app.View · 134 unmodified lines
135 135
136 afterRoute: (name, context) =>136 afterRoute: (name, context) =>
137 @delay @searchUrl if context.hash137 @delay @searchUrl if context.hash
138 @autoFocus()138 @delay @autoFocus
139 return
139 140
140 extractHashValue: ->141 extractHashValue: ->
141 if (value = @getHashValue())?142 if (value = @getHashValue())?