style: rename

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-04-09 15:05:21 +09:00
parent 0af76f7dfa
commit 7fb1a3fc81
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99
4 changed files with 13 additions and 13 deletions

View File

@ -77,7 +77,7 @@
import { computed, onMounted, onBeforeUnmount, ref } from 'vue';
import tinycolor from 'tinycolor2';
import { globalEvents } from '@/events.js';
import { defaultIdleRender } from '@/scripts/idle-render.js';
import { defaultIdlingRenderScheduler } from '@/scripts/idle-render.js';
// https://stackoverflow.com/questions/1878907/how-can-i-find-the-difference-between-two-angles
const angleDiff = (a: number, b: number) => {
@ -165,7 +165,7 @@ function tick() {
mAngle = Math.PI * (m + s / 60) / 30;
if (sOneRound && sLine.value) { // (59->0)
sAngle = Math.PI * 60 / 30;
defaultIdleRender.delete(tick);
defaultIdlingRenderScheduler.delete(tick);
sLine.value.addEventListener('transitionend', () => {
disableSAnimate = true;
requestAnimationFrame(() => {
@ -173,7 +173,7 @@ function tick() {
requestAnimationFrame(() => {
disableSAnimate = false;
if (enabled) {
defaultIdleRender.add(tick);
defaultIdlingRenderScheduler.add(tick);
}
});
});
@ -201,13 +201,13 @@ function calcColors() {
calcColors();
onMounted(() => {
defaultIdleRender.add(tick);
defaultIdlingRenderScheduler.add(tick);
globalEvents.on('themeChanged', calcColors);
});
onBeforeUnmount(() => {
enabled = false;
defaultIdleRender.delete(tick);
defaultIdlingRenderScheduler.delete(tick);
globalEvents.off('themeChanged', calcColors);
});
</script>

View File

@ -12,7 +12,7 @@
<script lang="ts" setup>
import { onMounted, onUnmounted, ref, watch } from 'vue';
import { defaultIdleRender } from '@/scripts/idle-render.js';
import { defaultIdlingRenderScheduler } from '@/scripts/idle-render.js';
const props = withDefaults(defineProps<{
showS?: boolean;
@ -55,11 +55,11 @@ const tick = (): void => {
tick();
onMounted(() => {
defaultIdleRender.add(tick);
defaultIdlingRenderScheduler.add(tick);
});
onUnmounted(() => {
defaultIdleRender.delete(tick);
defaultIdlingRenderScheduler.delete(tick);
});
</script>

View File

@ -11,7 +11,7 @@
import { onUnmounted } from 'vue';
import { i18n } from '@/i18n';
import { dateTimeFormat } from '@/scripts/intl-const';
import { defaultIdleRender } from '@/scripts/idle-render.js';
import { defaultIdlingRenderScheduler } from '@/scripts/idle-render.js';
const props = withDefaults(defineProps<{
time: Date | string | number | null;
@ -52,10 +52,10 @@ function tick(): void {
if (props.mode === 'relative' || props.mode === 'detail') {
tick();
defaultIdleRender.add(tick);
defaultIdlingRenderScheduler.add(tick);
onUnmounted(() => {
defaultIdleRender.delete(tick);
defaultIdlingRenderScheduler.delete(tick);
});
}
</script>

View File

@ -1,5 +1,5 @@
// eslint-disable-next-line import/no-default-export
export default class IdleRender {
export default class IdlingRenderScheduler {
#renderers: Set<FrameRequestCallback>;
#budget: number;
#rafId: number;
@ -38,4 +38,4 @@ export default class IdleRender {
}
}
export const defaultIdleRender = new IdleRender();
export const defaultIdlingRenderScheduler = new IdlingRenderScheduler();