From ed9ce87d99be04328b61df4f86c3b7009a00d1c4 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 14 Mar 2015 02:06:22 +0300 Subject: [PATCH] Editor: add sections asynchronously on init Improves perceived responsiveness. Becomes noticeable with ~3 sections. Becomes indispensable with ~10 sections. --- edit.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/edit.js b/edit.js index 8fb886db..bab1ba39 100644 --- a/edit.js +++ b/edit.js @@ -489,7 +489,11 @@ function initWithStyle(style) { Array.prototype.forEach.call(document.querySelectorAll("#sections > div"), function(div) { div.parentNode.removeChild(div); }); - style.sections.forEach(function(section) { addSection(null, section) }); + style.sections.forEach(function(section) { + setTimeout(function() { + addSection(null, section) + }, 0); + }); setupGlobalSearch(); setCleanGlobal(null); initTitle();