refactor: 메모리 누수 정리 및 타이머 관리 개선, 이벤트 리스너 제거 함수 추가
This commit is contained in:
@@ -24,6 +24,7 @@ const { sendLog, useAnalyticsLogDataDirect } = useAnalytics()
|
||||
|
||||
const slideThumbnailRef = ref<any>(null)
|
||||
const playingSlideIndex = ref<number | null>(null)
|
||||
let stopVideoTimeoutId: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
const backgroundData = computed(() =>
|
||||
getComponentGroup(props.components, 'background')
|
||||
@@ -89,12 +90,27 @@ const handleVideoClick = (index: number) => {
|
||||
}
|
||||
|
||||
const stopVideo = () => {
|
||||
// 이전 타이머 정리
|
||||
if (stopVideoTimeoutId) {
|
||||
clearTimeout(stopVideoTimeoutId)
|
||||
stopVideoTimeoutId = null
|
||||
}
|
||||
|
||||
// 전환 시간 후 완전히 제거
|
||||
setTimeout(() => {
|
||||
stopVideoTimeoutId = setTimeout(() => {
|
||||
playingSlideIndex.value = null
|
||||
stopVideoTimeoutId = null
|
||||
}, 400)
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
// 타이머 정리
|
||||
if (stopVideoTimeoutId) {
|
||||
clearTimeout(stopVideoTimeoutId)
|
||||
stopVideoTimeoutId = null
|
||||
}
|
||||
})
|
||||
|
||||
const onArrowClick = (direction, targetIndex) => {
|
||||
const arrowGroupAry = getComponentGroupAry(props.components, 'arrow')
|
||||
const logTracking = arrowGroupAry?.[direction === 'prev' ? 0 : 1]
|
||||
|
||||
Reference in New Issue
Block a user