1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-10-31 23:31:48 +09:00

perf(client): improve MkTime performance

This commit is contained in:
syuilo 2023-01-04 08:54:54 +09:00
parent c89410cab0
commit 697836c17c

View File

@ -37,12 +37,13 @@ const relative = $computed(() => {
});
function tick() {
// TODO:
now = new Date();
const ago = (now.getTime() - _time.getTime()) / 1000/*ms*/;
const next = ago < 60 ? 10000 : ago < 3600 ? 60000 : 180000;
tickId = window.setTimeout(() => {
window.requestAnimationFrame(tick);
}, 10000);
}, next);
}
let tickId: number;