mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-26 07:55:14 +00:00
Update MkTime.vue
This commit is contained in:
parent
513cef50a2
commit
457670e730
1 changed files with 5 additions and 7 deletions
|
@ -36,23 +36,21 @@ const relative = $computed(() => {
|
|||
i18n.ts._ago.future);
|
||||
});
|
||||
|
||||
let tickId: number;
|
||||
|
||||
function tick() {
|
||||
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);
|
||||
}, next);
|
||||
tickId = window.setTimeout(tick, next);
|
||||
}
|
||||
|
||||
let tickId: number;
|
||||
|
||||
if (props.mode === 'relative' || props.mode === 'detail') {
|
||||
tickId = window.requestAnimationFrame(tick);
|
||||
tick();
|
||||
|
||||
onUnmounted(() => {
|
||||
window.cancelAnimationFrame(tickId);
|
||||
window.clearTimeout(tickId);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue