mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-05 13:27:49 +08:00
improved single list command line performance by batching appends
This commit is contained in:
parent
b34ed3f22b
commit
24828801da
1 changed files with 4 additions and 3 deletions
|
@ -2023,14 +2023,15 @@ function updateSuggestedCommands() {
|
|||
|
||||
function displayFoundCommands() {
|
||||
$("#commandLine .suggestions").empty();
|
||||
let commandsHTML = "";
|
||||
let list = currentCommands[currentCommands.length - 1];
|
||||
$.each(list.list, (index, obj) => {
|
||||
if (obj.found && (obj.available !== undefined ? obj.available() : true)) {
|
||||
$("#commandLine .suggestions").append(
|
||||
'<div class="entry" command="' + obj.id + '">' + obj.display + "</div>"
|
||||
);
|
||||
commandsHTML +=
|
||||
'<div class="entry" command="' + obj.id + '">' + obj.display + "</div>";
|
||||
}
|
||||
});
|
||||
$("#commandLine .suggestions").html(commandsHTML);
|
||||
if ($("#commandLine .suggestions .entry").length == 0) {
|
||||
$("#commandLine .separator").css({ height: 0, margin: 0 });
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue