ui performance optimizations

Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-04-19 16:14:19 +02:00
parent 271a3421d6
commit 6128e0f84b
9 changed files with 252 additions and 59 deletions
+12
View File
@@ -1,3 +1,12 @@
window.logRingBuffer = [];
window.logBufferDirty = false;
const logBuffer = (ts, type, msg) => {
window.logRingBuffer.push({ ts, type, msg });
if (window.logRingBuffer.length > 10) window.logRingBuffer.shift();
window.logBufferDirty = true;
};
const scrollBottom = async (el) => {
const lastChild = el.lastElementChild;
if (lastChild) lastChild.scrollIntoView({ behavior: 'smooth' });
@@ -11,6 +20,7 @@ const log = async (...msg) => {
scrollBottom(window.logger);
}
console.log(ts, ...msg);
logBuffer(ts, 'log', msg);
};
const debug = async (...msg) => {
@@ -21,6 +31,7 @@ const debug = async (...msg) => {
scrollBottom(window.logger);
}
console.debug(ts, ...msg);
logBuffer(ts, 'debug', msg);
};
const error = async (...msg) => {
@@ -31,6 +42,7 @@ const error = async (...msg) => {
scrollBottom(window.logger);
}
console.error(ts, ...msg);
logBuffer(ts, 'error', msg);
// const txt = msg.join(' ');
// if (!txt.includes('asctime') && !txt.includes('xhr.')) xhrPost('/sdapi/v1/log', { error: txt }); // eslint-disable-line no-use-before-define
};