diff --git a/types/audiosprite/audiosprite-tests.ts b/types/audiosprite/audiosprite-tests.ts new file mode 100644 index 0000000000..a3f400d454 --- /dev/null +++ b/types/audiosprite/audiosprite-tests.ts @@ -0,0 +1,26 @@ +import * as audiosprite from 'audiosprite'; + +const files = ['file1.mp3', 'file2.mp3']; +const opts = {output: 'result'}; + +audiosprite(files, opts, (err, obj) => { + if (err) { + return err; + } + + return JSON.stringify(obj, null, 2); +}); + +audiosprite(files, { + path: "aaa", + format: "howler", + export: "ogg,mp3", + minlength: 9999, + vbr: 9, + 'vbr:vorbis': 10, + logger: { + debug(a) { + } + } +}, (err, obj) => { +}); diff --git a/types/audiosprite/index.d.ts b/types/audiosprite/index.d.ts new file mode 100644 index 0000000000..c1738386d6 --- /dev/null +++ b/types/audiosprite/index.d.ts @@ -0,0 +1,55 @@ +// Type definitions for audiosprite 0.6 +// Project: https://github.com/tonistiigi/audiosprite +// Definitions by: Gyusun Yeom +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace audiosprite; +export = audiosprite; + +declare function audiosprite(files: string[], callback: (error: Error, obj: audiosprite.Result) => void): void; +declare function audiosprite(files: string[], option: audiosprite.Option, callback: (error: Error, obj: audiosprite.Result) => void): void; + +declare namespace audiosprite { + type ExportType = "jukebox" | "howler" | "createjs" | null; + type LogLevel = "debug" | "info" | "notice" | "warning" | "error"; + type VBR = -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; + type VBR_Vorbis = VBR | 10; + type Channels = 1 | 2; + interface Option { + output?: string; + path?: string; + export?: string; + format?: ExportType; + log?: LogLevel; + autoplay?: string | null; + loop?: string[]; + silence?: number; + gap?: number; + minlength?: number; + bitrate?: number; + vbr?: VBR; + 'vbr:vorbis'?: VBR_Vorbis; + samplerate?: number; + channels?: Channels; + rawparts?: string; + logger?: Logger; + } + + interface Logger { + debug?(...log: any[]): void; + info?(...log: any[]): void; + log?(...log: any[]): void; + } + + interface Result { + resources: string[]; + spritemap: { + [key: string]: { + start: number; + end: number; + loop: boolean; + } + }; + autoplay?: string; + } +} diff --git a/types/audiosprite/tsconfig.json b/types/audiosprite/tsconfig.json new file mode 100644 index 0000000000..7348d046e8 --- /dev/null +++ b/types/audiosprite/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "audiosprite-tests.ts" + ] +} diff --git a/types/audiosprite/tslint.json b/types/audiosprite/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/audiosprite/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }