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

View File

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

View File

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

View File

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