style: rename
This commit is contained in:
parent
0af76f7dfa
commit
7fb1a3fc81
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue