-
Notifications
You must be signed in to change notification settings - Fork 0
/
use-sound.d.ts
43 lines (35 loc) · 1.08 KB
/
use-sound.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
declare module "use-sound" {
import { Howl, Howler } from "howler"
interface HookOptions {
volume?: number
playbackRate?: number
interrupt?: boolean
soundEnabled?: boolean
sprite?: { [key: string]: [number, number] }
// You can add more properties as needed based on your use case
}
interface ExposedData {
volume: number
playbackRate: number
interrupt: boolean
soundEnabled: boolean
sprite: { [key: string]: [number, number] }
// You can add more properties as needed based on your use case
}
type PlayFunction = (options?: PlayOptions) => void
interface PlayOptions {
id?: string
forceSoundEnabled?: boolean
playbackRate?: number
// You can add more properties as needed based on your use case
}
interface PlayExposedData extends ExposedData {
stop: (id?: string) => void
pause: (id?: string) => void
duration: number | null
sound: Howl | null
}
type UseSoundTuple = [PlayFunction, PlayExposedData]
const useSound: (src: string, options?: HookOptions) => UseSoundTuple
export default useSound
}