Improve load time with a single write to innerHTML instead of one for every entry.

This commit is contained in:
kor 2018-10-30 21:09:48 +13:00
parent 83f54dc2db
commit 5128929933
2 changed files with 15 additions and 8 deletions

View File

@ -4068,3 +4068,10 @@ ORKL
LINK : https://github.com/kodedninja/orkl
NOTE : reference for memex loading (spinner)
TAGS : p2p, dat, blog
WITH LOVE FROM VERY SMALL PLACES
DATE : 12018-10-30
TYPE : music
AUTH : kodedninja
TAGS : ambient, calm
LINK : https://0x22.bandcamp.com/album/with-love-from-very-small-places

View File

@ -58,14 +58,15 @@ function View()
}
// BUILD
this.grid.innerHTML = '';
var dbKeys = Object.keys(db);
var i = 0;
let dbKeys = Object.keys(db);
let i = 0;
let contentHtml = '';
while (i < dbKeys.length)
{
this.buildEntry(db, dbKeys[i]);
contentHtml += this.buildEntry(db, dbKeys[i]);
i++;
}
this.grid.innerHTML = contentHtml;
// LAYOUT
if (SETTINGS.USEMASONRY)
@ -74,7 +75,7 @@ function View()
this.msnry.layout();
}
var imgLoad = imagesLoaded( container );
let imgLoad = imagesLoaded( container );
// When all images finish: redo mansonry layout
imgLoad.on( 'always', function() { parent.msnry.layout(); } );
}
@ -324,8 +325,7 @@ function View()
}
entry += `</div>`;
this.grid.innerHTML += entry;
return entry;
}
this.doTypeIcon = function(type, count)