mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 17:47:16 +00:00
Type define music-metadata-browser lazy-load-require function.
Add comment to type music-metadata-browser imports.
This commit is contained in:
parent
94fdec82b8
commit
390ccc5bc5
2 changed files with 35 additions and 4 deletions
|
|
@ -1,7 +1,5 @@
|
|||
import invariant from "invariant";
|
||||
import { IAudioMetadata, IOptions } from 'music-metadata-browser';
|
||||
|
||||
type JsMediaTagsFile = string | ArrayBuffer | Blob;
|
||||
import { IAudioMetadata } from 'music-metadata-browser'; // Import music-metadata type definitions
|
||||
|
||||
type MediaDataType = string | ArrayBuffer | Blob;
|
||||
|
||||
|
|
|
|||
35
js/types.ts
35
js/types.ts
|
|
@ -8,6 +8,7 @@ import { EqualizerState } from "./reducers/equalizer";
|
|||
import { NetworkState } from "./reducers/network";
|
||||
import { SerializedStateV1 } from "./serializedStates/v1Types";
|
||||
import { TracksState } from "./reducers/tracks";
|
||||
import { IAudioMetadata, IOptions } from 'music-metadata-browser';
|
||||
|
||||
export {
|
||||
WebampWindow,
|
||||
|
|
@ -517,9 +518,41 @@ export interface AppState {
|
|||
tracks: TracksState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type definition of the music-metadata-browser module.
|
||||
* Ref: https://github.com/Borewit/music-metadata-browser/blob/master/src/index.ts
|
||||
*/
|
||||
export interface IMusicMetadataBrowserApi {
|
||||
|
||||
/**
|
||||
* Parse Web API File
|
||||
* @param {Blob} blob
|
||||
* @param {IOptions} options Parsing options
|
||||
* @returns {Promise<IAudioMetadata>}
|
||||
*/
|
||||
parseBlob(blob: Blob, options?: IOptions): Promise<IAudioMetadata>;
|
||||
|
||||
/**
|
||||
* Parse fetched file, using the Web Fetch API
|
||||
* @param {string} audioTrackUrl URL to download the audio track from
|
||||
* @param {IOptions} options Parsing options
|
||||
* @returns {Promise<IAudioMetadata>}
|
||||
*/
|
||||
fetchFromUrl(audioTrackUrl: string, options?: IOptions): Promise<IAudioMetadata>;
|
||||
|
||||
/**
|
||||
* Parse audio from Node Buffer
|
||||
* @param {Stream.Readable} stream Audio input stream
|
||||
* @param {string} mimeType <string> Content specification MIME-type, e.g.: 'audio/mpeg'
|
||||
* @param {IOptions} options Parsing options
|
||||
* @returns {Promise<IAudioMetadata>}
|
||||
*/
|
||||
parseBuffer(buf: Buffer, mimeType?: string, options?: IOptions): Promise<IAudioMetadata>;
|
||||
}
|
||||
|
||||
export interface Extras {
|
||||
requireJSZip: () => Promise<never>;
|
||||
requireMusicMetadata: () => Promise<never>;
|
||||
requireMusicMetadata: () => Promise<IMusicMetadataBrowserApi>;
|
||||
}
|
||||
|
||||
export type GetState = () => AppState;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue