From f8f9463baa8df531935303044360c9a34d2d841b Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Tue, 4 Sep 2018 21:35:34 -0700 Subject: [PATCH] Format index.d.ts with Prettier --- index.d.ts | 278 ++++++++++++++++++++++++++------------------------- package.json | 2 +- 2 files changed, 141 insertions(+), 139 deletions(-) diff --git a/index.d.ts b/index.d.ts index 17aa2767..785c8edd 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,48 +1,48 @@ interface TrackInfo { - /** - * Name to be used until ID3 tags can be resolved. - * - * If the track has a `url`, and this property is not given, - * the filename will be used instead. - * - * Example: `'My Song'` - */ - defaultName?: string; + /** + * Name to be used until ID3 tags can be resolved. + * + * If the track has a `url`, and this property is not given, + * the filename will be used instead. + * + * Example: `'My Song'` + */ + defaultName?: string; - /** - * Data to be used _instead_ of trying to fetch ID3 tags. - * - * Example: `{ artist: 'Jordan Eldredge', title: "Jordan's Song" }` - */ - metaData?: { - artist: string, - title: string, - }, + /** + * Data to be used _instead_ of trying to fetch ID3 tags. + * + * Example: `{ artist: 'Jordan Eldredge', title: "Jordan's Song" }` + */ + metaData?: { + artist: string; + title: string; + }; - /** - * Duration (in seconds) to be used instead of fetching enough of the file to measure its length. - * - * Example: 95 - */ - duration?: number; + /** + * Duration (in seconds) to be used instead of fetching enough of the file to measure its length. + * + * Example: 95 + */ + duration?: number; } interface URLTrack extends TrackInfo { - /** - * Source URL of the track - * - * Note: This URL must be served the with correct CORs headers. - * - * Example: `'https://example.com/song.mp3'` - */ - url: string | URL; + /** + * Source URL of the track + * + * Note: This URL must be served the with correct CORs headers. + * + * Example: `'https://example.com/song.mp3'` + */ + url: string | URL; } interface BlobTrack extends TrackInfo { - /** - * Blob source of the track - */ - blob: Blob; + /** + * Blob source of the track + */ + blob: Blob; } /** @@ -53,122 +53,124 @@ interface BlobTrack extends TrackInfo { type Track = URLTrack | BlobTrack; interface Options { - /** - * An object representing the initial skin to use. - * - * If omitted, the default skin, included in the bundle, will be used. - * Note: This URL must be served the with correct CORs headers. - * - * Example: `{ url: './path/to/skin.wsz' }` - */ - initialSkin?: { - url: string, - }; + /** + * An object representing the initial skin to use. + * + * If omitted, the default skin, included in the bundle, will be used. + * Note: This URL must be served the with correct CORs headers. + * + * Example: `{ url: './path/to/skin.wsz' }` + */ + initialSkin?: { + url: string; + }; - /** - * An array of `Track`s to prepopulate the playlist with. - */ - initialTracks?: Track[]; + /** + * An array of `Track`s to prepopulate the playlist with. + */ + initialTracks?: Track[]; - /** - * An array of objects representing available skins. - * - * These will appear in the "Options" menu under "Skins". - * Note: These URLs must be served with the correct CORs headers. - * - * Example: `[ { url: "./green.wsz", name: "Green Dimension V2" } ]` - */ - availableSkins?: { url: string, name: string }[]; + /** + * An array of objects representing available skins. + * + * These will appear in the "Options" menu under "Skins". + * Note: These URLs must be served with the correct CORs headers. + * + * Example: `[ { url: "./green.wsz", name: "Green Dimension V2" } ]` + */ + availableSkins?: { url: string; name: string }[]; - /** - * Should global hotkeys be enabled? - * - * Default: `false` - */ - enableHotkeys?: boolean; + /** + * Should global hotkeys be enabled? + * + * Default: `false` + */ + enableHotkeys?: boolean; - /** - * An array of additional file pickers. - * - * These will appear in the "Options" menu under "Play". - * - * In the offical version, this option is used to provide a "Dropbox" file picker. - */ - filePickers?: [{ - /** - * The name that will appear in the context menu. - * - * Example: `"My File Picker..."` - */ - contextMenuName: string, + /** + * An array of additional file pickers. + * + * These will appear in the "Options" menu under "Play". + * + * In the offical version, this option is used to provide a "Dropbox" file picker. + */ + filePickers?: [ + { + /** + * The name that will appear in the context menu. + * + * Example: `"My File Picker..."` + */ + contextMenuName: string; - /** - * A function which returns a Promise that resolves to an array of `Track`s - * - * Example: `() => Promise.resolve([{ url: './rick_roll.mp3' }])` - */ - filePicker: () => Promise, + /** + * A function which returns a Promise that resolves to an array of `Track`s + * + * Example: `() => Promise.resolve([{ url: './rick_roll.mp3' }])` + */ + filePicker: () => Promise; - /** - * Indicates if this options should be made available when the user is offline. - */ - requiresNetwork: boolean, - }]; + /** + * Indicates if this options should be made available when the user is offline. + */ + requiresNetwork: boolean; + } + ]; } export default class Webamp { - constructor(options: Options); + constructor(options: Options); - /** - * Returns a true if the current browser supports the features that Webamp depends upon. - * - * It is recommended to check this before you attempt to instantiate an instance of Winamp. - */ - public static browserIsSupported(): boolean; + /** + * Returns a true if the current browser supports the features that Webamp depends upon. + * + * It is recommended to check this before you attempt to instantiate an instance of Winamp. + */ + public static browserIsSupported(): boolean; - /** - * Add an array of `Track`s to the end of the playlist. - */ - public appendTracks(tracks: Track[]): void; + /** + * Add an array of `Track`s to the end of the playlist. + */ + public appendTracks(tracks: Track[]): void; - /** - * Replace the playlist with an array of `Track`s and begin playing the first track. - */ - public setTracksToPlay(tracks: Track[]): void; + /** + * Replace the playlist with an array of `Track`s and begin playing the first track. + */ + public setTracksToPlay(tracks: Track[]): void; - /** - * Webamp will wait until it has fetched the skin and fully parsed it and then render itself. - * - * Webamp is rendered into a new DOM node at the end of the tag with the id `#webamp`. - * - * If a domNode is passed, Webamp will place itself in the center of that DOM node. - * - * @returns A promise is returned which will resolve after the render is complete. - */ - public renderWhenReady(domNode: HTMLElement): Promise; + /** + * Webamp will wait until it has fetched the skin and fully parsed it and then render itself. + * + * Webamp is rendered into a new DOM node at the end of the tag with the id `#webamp`. + * + * If a domNode is passed, Webamp will place itself in the center of that DOM node. + * + * @returns A promise is returned which will resolve after the render is complete. + */ + public renderWhenReady(domNode: HTMLElement): Promise; - /** - * A callback which will be called when a new track starts loading. - * - * This can happen on startup when the first track starts buffering, or when a subsequent track starts playing. - * The callback will be called with an object `({url: 'https://example.com/track.mp3'})` containing the URL of the track. - * Note: If the user drags in a track, the URL may be an ObjectURL. - * - * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events. - */ - public onTrackDidChange(callback: (track: Track) => any): () => void; + /** + * A callback which will be called when a new track starts loading. + * + * This can happen on startup when the first track starts buffering, or when a subsequent track starts playing. + * The callback will be called with an object `({url: 'https://example.com/track.mp3'})` containing the URL of the track. + * Note: If the user drags in a track, the URL may be an ObjectURL. + * + * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events. + */ + public onTrackDidChange(callback: (track: Track) => any): () => void; - /** - * A callback which will be called when Webamp is closed. - * - * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events. - */ - public onClose(callback: () => any): () => void; + /** + * A callback which will be called when Webamp is closed. + * + * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events. + */ + public onClose(callback: () => any): () => void; - /** - * A callback which will be called when Webamp is minimized. - * - * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events. - */ - public onMinimize(callback: () => any): () => void; + /** + * A callback which will be called when Webamp is minimized. + * + * @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events. + */ + public onMinimize(callback: () => any): () => void; } diff --git a/package.json b/package.json index 7f861cfb..cb48d54b 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "test": "jest --projects config/jest.unit.js config/jest.eslint.js", "travis-tests": "npm run test && npm run type-check && npm run build && npm run build-library", "tdd": "jest --projects config/jest.unit.js --watch", - "format": "prettier --write experiments/**/*.js js/**/*.js css/**/*.css !css/**/*.min.css", + "format": "prettier --write experiments/**/*.js js/**/*.js **/*.d.ts css/**/*.css !css/**/*.min.css", "integration-tests": "npm run build -- --display=errors-only && jest --projects config/jest.integration.js", "build-skin": "rm skins/base-2.91.wsz && cd skins/base-2.91 && zip -x .* -x 'Skining Updates.txt' -r ../base-2.91.wsz .", "build-skin-png": "rm skins/base-2.91-png.wsz && cd skins/base-2.91-png && zip -x .* -x 'Skining Updates.txt' -r ../base-2.91-png.wsz .",