From 14395885811e4a3beecb6782cacf510528e822b9 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 2 Dec 2015 08:45:58 +0100 Subject: [PATCH] Improved init task rendering, reduced dom operations. --- .../app/controllers/_application_controller.coffee | 4 +++- .../javascripts/app/lib/app_post/task_manager.coffee | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller.coffee b/app/assets/javascripts/app/controllers/_application_controller.coffee index 5008e5378..8c7874846 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.coffee @@ -542,9 +542,11 @@ class App.Controller extends Spine.Controller @html App.view('generic/error/unauthorized')(data) metaTaskUpdate: -> + delay = App.TaskManager.renderDelay() + return if !delay App.Delay.set( -> App.Event.trigger 'task:render' - App.TaskManager.renderDelay() + delay 'meta-task-update' ) diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.coffee index 5e80dfec6..0151b8878 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.coffee @@ -496,10 +496,17 @@ class _taskManagerSingleton extends App.Controller 'task' ) - # set new renderDelayTime + # handle init task rendering at loading time, prevent multible, not needed dom operations + @initTaskRenderInterval = App.Interval.set( + -> + App.Event.trigger('task:render') + 1200 + ) App.Delay.set( => + App.Interval.clear(@initTaskRenderInterval) @renderDelayTime = 20 + App.Event.trigger('task:render') task_count * 450 )