mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-05 13:27:49 +08:00
improved showWords() performance by batching appends
This commit is contained in:
parent
b875d7933f
commit
2cfe0fb2ff
1 changed files with 5 additions and 4 deletions
|
@ -843,14 +843,15 @@ function addWord() {
|
|||
function showWords() {
|
||||
$("#words").empty();
|
||||
|
||||
let wordsHTML = "";
|
||||
for (let i = 0; i < wordsList.length; i++) {
|
||||
let w = "<div class='word'>";
|
||||
wordsHTML += "<div class='word'>";
|
||||
for (let c = 0; c < wordsList[i].length; c++) {
|
||||
w += "<letter>" + wordsList[i].charAt(c) + "</letter>";
|
||||
wordsHTML += "<letter>" + wordsList[i].charAt(c) + "</letter>";
|
||||
}
|
||||
w += "</div>";
|
||||
$("#words").append(w);
|
||||
wordsHTML += "</div>";
|
||||
}
|
||||
$("#words").html(wordsHTML);
|
||||
|
||||
$("#wordsWrapper").removeClass("hidden");
|
||||
const wordHeight = $(document.querySelector(".word")).outerHeight(true);
|
||||
|
|
Loading…
Reference in a new issue