forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
howler.d.ts
73 lines (64 loc) · 2.02 KB
/
howler.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Type definitions for howler.js v1.1.25
// Project: https://github.com/goldfire/howler.js
// Definitions by: Pedro Casaubon <https://github.com/xperiments/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare class HowlerGlobal {
mute(): HowlerGlobal;
unmute(): HowlerGlobal;
volume(): number;
volume(volume: number): HowlerGlobal;
codecs(extension: string): boolean;
iOSAutoEnable: boolean;
}
declare var Howler: HowlerGlobal;
interface IHowlCallback {
(): void;
}
interface IHowlSoundSpriteDefinition {
[name: string]: number[]
}
interface IHowlProperties {
autoplay?: boolean;
buffer?: boolean;
format?: string;
loop?: boolean;
sprite?: IHowlSoundSpriteDefinition;
volume?: number;
urls?: string[];
onend?: IHowlCallback;
onload?: IHowlCallback;
onloaderror?: IHowlCallback;
onpause?: IHowlCallback;
onplay?: IHowlCallback;
}
declare class Howl {
autoplay: Boolean;
buffer: Boolean;
format: string;
rate: number;
model: string;
onend: IHowlCallback;
onload: IHowlCallback;
onloaderror: IHowlCallback;
onpause: IHowlCallback;
onplay: IHowlCallback;
constructor(properties: IHowlProperties);
play(sprite?: string, callback?: (soundId: number) => void): Howl;
pause(soundId?: number): Howl;
stop(soundId?: number): Howl;
mute(soundId?: number): Howl;
unmute(soundId?: number): Howl;
fade(from: number, to: number, duration: number, callback?: IHowlCallback, soundId?: number): Howl;
loop(): boolean;
loop(loop: boolean): Howl;
pos(position?: number, soundId?: number): number;
pos3d(x: number, y: number, z: number, soundId?: number): any;
sprite(definition?: IHowlSoundSpriteDefinition): IHowlSoundSpriteDefinition;
volume(): number;
volume(volume?: number, soundId?: number): Howl;
urls(): string[];
urls(urls: string[]): Howl;
on(event: string, listener?: () => void): Howl;
off(event: string, listener?: () => void): Howl;
unload(): void;
}