浏览代码

Minor performance optimization to speed up app boot

Thibaut Courouble 8 年之前
父节点
当前提交
d59d43e64b

+ 4 - 2
assets/javascripts/app/app.coffee

@@ -105,8 +105,10 @@
     @trigger 'ready'
     @router.start()
     @hideLoading()
-    @welcomeBack() unless @doc
-    @removeEvent 'ready bootError'
+    setTimeout =>
+      @welcomeBack() unless @doc
+      @removeEvent 'ready bootError'
+    , 50
     return
 
   initDoc: (doc) ->

+ 2 - 2
assets/javascripts/app/update_checker.coffee

@@ -5,7 +5,7 @@ class app.UpdateChecker
     $.on window, 'focus', @checkForUpdate
     app.appCache.on 'updateready', @onUpdateReady if app.appCache
 
-    @checkDocs()
+    setTimeout @checkDocs, 0
 
   check: ->
     if app.appCache
@@ -21,7 +21,7 @@ class app.UpdateChecker
     new app.views.Notif 'UpdateReady', autoHide: null
     return
 
-  checkDocs: ->
+  checkDocs: =>
     unless app.settings.get('manualUpdate')
       app.docs.updateInBackground()
     else

+ 2 - 1
assets/javascripts/views/search/search.coffee

@@ -135,7 +135,8 @@ class app.views.Search extends app.View
 
   afterRoute: (name, context) =>
     @delay @searchUrl if context.hash
-    @autoFocus()
+    @delay @autoFocus
+    return
 
   extractHashValue: ->
     if (value = @getHashValue())?