forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
howler.d.ts
85 lines (76 loc) · 2.33 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
73
74
75
76
77
78
79
80
81
82
83
84
85
// Type definitions for howler.js v1.1.29
// 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 IHowlSoundSpriteDefinition {
[name: string]: number[];
}
declare type HowlPos3d = [number, number, number]|[number, number, number, number];
interface IHowlProperties {
autoplay?: boolean;
buffer?: boolean;
duration?: number;
format?: string;
loop?: boolean;
sprite?: IHowlSoundSpriteDefinition;
src?: string;
pos3d?: HowlPos3d;
volume?: number;
urls?: string[];
rate?: number;
model?: 'equalpower'|'HRTF';
onend?: Function;
onload?: Function;
onloaderror?: Function;
onpause?: Function;
onplay?: Function;
}
interface Howl {
autoplay: Boolean;
buffer: Boolean;
format: string;
rate: number;
model: string;
onend: Function;
onload: Function;
onloaderror: Function;
onpause: Function;
onplay: Function;
load(): Howl;
play(sprite?: string, callback?: (soundId: number) => void): Howl;
play(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?: Function, 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?: Function): Howl;
off(event: string, listener?: Function): Howl;
unload(): void;
}
interface HowlStatic {
new (properties: IHowlProperties): Howl;
}
declare let Howl: HowlStatic;
declare module "howler" {
export let Howler: HowlerGlobal;
export let Howl: HowlStatic;
}