don't update command progress CSS property if not changed
performance improvement from luccy
This commit is contained in:
parent
2ac2a2537d
commit
621ef197da
|
@ -3498,11 +3498,18 @@ export async function executeSlashCommandsOnChatInput(text, options = {}) {
|
||||||
|
|
||||||
/**@type {SlashCommandClosureResult} */
|
/**@type {SlashCommandClosureResult} */
|
||||||
let result = null;
|
let result = null;
|
||||||
|
let currentProgress = '';
|
||||||
try {
|
try {
|
||||||
commandsFromChatInputAbortController = new SlashCommandAbortController();
|
commandsFromChatInputAbortController = new SlashCommandAbortController();
|
||||||
result = await executeSlashCommandsWithOptions(text, {
|
result = await executeSlashCommandsWithOptions(text, {
|
||||||
abortController: commandsFromChatInputAbortController,
|
abortController: commandsFromChatInputAbortController,
|
||||||
onProgress: (done, total) => ta.style.setProperty('--prog', `${done / total * 100}%`),
|
onProgress: (done, total) => {
|
||||||
|
const newProgress = `${done / total * 100}%`;
|
||||||
|
if (newProgress !== currentProgress) {
|
||||||
|
currentProgress = newProgress;
|
||||||
|
ta.style.setProperty('--prog', newProgress);
|
||||||
|
}
|
||||||
|
},
|
||||||
parserFlags: options.parserFlags,
|
parserFlags: options.parserFlags,
|
||||||
scope: options.scope,
|
scope: options.scope,
|
||||||
source: options.source,
|
source: options.source,
|
||||||
|
|
Loading…
Reference in New Issue