further reduce overhead

This commit is contained in:
MathMan05 2024-07-31 23:13:02 -05:00
parent 08d25f5082
commit ac4094394c
2 changed files with 85 additions and 71 deletions

View file

@ -908,6 +908,8 @@ class Channel {
}
Channel.setupcontextmenu();
export { Channel };
{
let last;
function fixsvgtheme() {
const things = document.getElementsByClassName("svgtheme");
//console.log(things);
@ -946,9 +948,14 @@ function fixsvgtheme() {
const rot = Math.floor(h * 60) + "deg";
const invert = .5 - (s / 2) + "";
const brightness = Math.floor((l * 200)) + "%";
const current = rot + invert + brightness;
if (current !== last) {
last = current;
document.documentElement.style.setProperty('--rot', rot);
document.documentElement.style.setProperty('--invert', invert);
document.documentElement.style.setProperty('--brightness', brightness);
}
}
}
setInterval(fixsvgtheme, 100);
}

View file

@ -899,6 +899,8 @@ class Channel{
}
Channel.setupcontextmenu();
export {Channel};
{
let last:string;
function fixsvgtheme(){
const things=document.getElementsByClassName("svgtheme");
//console.log(things);
@ -934,9 +936,14 @@ function fixsvgtheme(){
const rot=Math.floor(h*60)+"deg";
const invert=.5-(s/2)+"";
const brightness=Math.floor((l*200))+"%";
const current=rot+invert+brightness;
if(current!==last){
last=current;
document.documentElement.style.setProperty('--rot', rot);
document.documentElement.style.setProperty('--invert', invert);
document.documentElement.style.setProperty('--brightness', brightness);
}
}
}
setInterval(fixsvgtheme,100);
}