changed howler module definition

This commit is contained in:
Ilya Mochalov
2016-02-09 22:53:40 +05:00
parent f4b1797c12
commit 5641b4b1a4
2 changed files with 34 additions and 25 deletions

View File

@@ -4,6 +4,10 @@
*/
///<reference path="howler.d.ts"/>
import * as howler from "howler";
howler.Howler = Howler;
howler.Howl = Howl;
Howler.codecs('ogg');
Howler.iOSAutoEnable = true;
@@ -32,4 +36,4 @@ var sound = new Howl({
});
// shoot the laser!
sound.play('laser');
sound.play('laser');

53
howlerjs/howler.d.ts vendored
View File

@@ -1,9 +1,8 @@
// Type definitions for howler.js v1.1.25
// 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;
@@ -15,13 +14,10 @@ declare class HowlerGlobal {
declare var Howler: HowlerGlobal;
interface IHowlCallback {
(): void;
}
interface IHowlSoundSpriteDefinition {
[name: string]: number[]
[name: string]: number[];
}
interface IHowlProperties {
autoplay?: boolean;
buffer?: boolean;
@@ -30,33 +26,32 @@ interface IHowlProperties {
sprite?: IHowlSoundSpriteDefinition;
volume?: number;
urls?: string[];
onend?: IHowlCallback;
onload?: IHowlCallback;
onloaderror?: IHowlCallback;
onpause?: IHowlCallback;
onplay?: IHowlCallback;
onend?: Function;
onload?: Function;
onloaderror?: Function;
onpause?: Function;
onplay?: Function;
}
declare class Howl {
interface Howl {
autoplay: Boolean;
buffer: Boolean;
format: string;
rate: number;
model: string;
onend: IHowlCallback;
onload: IHowlCallback;
onloaderror: IHowlCallback;
onpause: IHowlCallback;
onplay: IHowlCallback;
constructor(properties: IHowlProperties);
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?: IHowlCallback, 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;
@@ -66,8 +61,18 @@ declare class Howl {
volume(volume?: number, soundId?: number): Howl;
urls(): string[];
urls(urls: string[]): Howl;
on(event: string, listener?: () => void): Howl;
off(event: string, listener?: () => void): 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;
}