Editor: add sections asynchronously on init

Improves perceived responsiveness.
Becomes noticeable with ~3 sections.
Becomes indispensable with ~10 sections.
This commit is contained in:
tophf 2015-03-14 02:06:22 +03:00
parent 374244fceb
commit ed9ce87d99

View File

@ -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();