mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-01-31 19:45:35 +01:00
rename syntax highlight update loop
This commit is contained in:
parent
5dc7b4567d
commit
0d8436aec6
@ -907,12 +907,12 @@ export class QuickReply {
|
|||||||
let lastSyntaxUpdate = 0;
|
let lastSyntaxUpdate = 0;
|
||||||
const fpsTime = 1000 / 30;
|
const fpsTime = 1000 / 30;
|
||||||
let lastMessageValue = null;
|
let lastMessageValue = null;
|
||||||
const upsyn = ()=>{
|
const updateSyntaxLoop = ()=>{
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
// fps limit
|
// fps limit
|
||||||
if (now - lastSyntaxUpdate < fpsTime) return requestAnimationFrame(upsyn);
|
if (now - lastSyntaxUpdate < fpsTime) return requestAnimationFrame(updateSyntaxLoop);
|
||||||
// elements don't exist (yet?)
|
// elements don't exist (yet?)
|
||||||
if (!messageSyntaxInner || !message) return requestAnimationFrame(upsyn);
|
if (!messageSyntaxInner || !message) return requestAnimationFrame(updateSyntaxLoop);
|
||||||
// elements no longer part of the document
|
// elements no longer part of the document
|
||||||
if (!messageSyntaxInner.closest('body')) return;
|
if (!messageSyntaxInner.closest('body')) return;
|
||||||
// value hasn't changed
|
// value hasn't changed
|
||||||
@ -920,9 +920,9 @@ export class QuickReply {
|
|||||||
lastSyntaxUpdate = now;
|
lastSyntaxUpdate = now;
|
||||||
lastMessageValue = message.value;
|
lastMessageValue = message.value;
|
||||||
updateSyntax();
|
updateSyntax();
|
||||||
requestAnimationFrame(upsyn);
|
requestAnimationFrame(updateSyntaxLoop);
|
||||||
};
|
};
|
||||||
requestAnimationFrame(()=>upsyn());
|
requestAnimationFrame(()=>updateSyntaxLoop());
|
||||||
message.style.setProperty('text-shadow', 'none', 'important');
|
message.style.setProperty('text-shadow', 'none', 'important');
|
||||||
updateWrap();
|
updateWrap();
|
||||||
updateTabSize();
|
updateTabSize();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user