@raffaelesgarro/vue-use-sound
Version:
🔊 A Vue composable for playing sound effects
16 lines (12 loc) • 487 B
text/typescript
import type { ComposableOptions } from '../../../types'
import { useSound as _useSound } from '../../../index'
import type { SoundsPaths } from '#build/sounds/types'
import { useNuxtApp } from '#imports'
export const useSound = (url: SoundsPaths, options: ComposableOptions = {}) => {
const { $sounds } = useNuxtApp()
// Merge global sound counfig with local one
if ($sounds[url]) {
options = { ...$sounds[url], ...options }
}
return _useSound(url as string, options)
}