-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuse-sound.d.ts
More file actions
47 lines (39 loc) · 1.14 KB
/
use-sound.d.ts
File metadata and controls
47 lines (39 loc) · 1.14 KB
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
44
45
46
47
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
onplay: () => void;
onend: () => void;
onpause: () => void;
format: [string];
}
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;
}