Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.

Commit 8354f9b

Browse files
committed
refactor(PositionalAudio.vue): remove duplicate audio buffer state declaration
- Eliminated the redundant declaration of the audio buffer state by consolidating it into a single instance using `useLoader`. This change enhances code clarity and maintains best practices for state management in Vue components.
1 parent 2a05cbc commit 8354f9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/abstractions/PositionalAudio.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const emit = defineEmits(['isPlaying'])
3636
3737
const { ready, url, distance, helper, loop, autoplay, innerAngle, outerAngle, outerGain } = toRefs(props)
3838
39+
const { state: buffer } = useLoader<AudioBuffer | AudioBuffer[]>(AudioLoader, url.value)
40+
3941
const { camera } = useTresContext()
4042
4143
const positionalAudioRef = shallowRef<PositionalAudio | null>(null)
@@ -132,8 +134,6 @@ defineExpose({
132134
dispose,
133135
})
134136
135-
const { state: buffer } = useLoader<AudioBuffer | AudioBuffer[]>(AudioLoader, url.value)
136-
137137
watch(positionalAudioRef, () => {
138138
if (!positionalAudioRef?.value) { return }
139139

0 commit comments

Comments
 (0)