mirror of
https://github.com/captbaritone/webamp
synced 2024-11-21 23:32:16 +00:00
Split out injectable dependencies
This commit is contained in:
parent
b2306c8f92
commit
3f3808c717
@ -27,6 +27,7 @@ import availableSkins from "./availableSkins";
|
||||
|
||||
import { initialTracks, initialState } from "./config";
|
||||
import screenshotInitialState from "./screenshotInitialState";
|
||||
import { InjectableDependencies } from "../../js/webampLazy.jsx";
|
||||
|
||||
const NOISY_ACTION_TYPES = new Set([
|
||||
STEP_MARQUEE,
|
||||
@ -60,7 +61,7 @@ export async function getWebampConfig(
|
||||
screenshot: boolean,
|
||||
skinUrl: string | null,
|
||||
soundCloudPlaylist: SoundCloud.SoundCloudPlaylist | null
|
||||
): Promise<Options & PrivateOptions> {
|
||||
): Promise<Options & PrivateOptions & InjectableDependencies> {
|
||||
let __butterchurnOptions;
|
||||
let windowLayout: WindowLayout | undefined;
|
||||
if (isButterchurnSupported()) {
|
||||
|
@ -40,8 +40,6 @@ import { SerializedStateV1 } from "./serializedStates/v1Types";
|
||||
import Disposable from "./Disposable";
|
||||
|
||||
export interface PrivateOptions {
|
||||
requireJSZip(): Promise<any>; // TODO: Type JSZip
|
||||
requireMusicMetadata(): Promise<any>; // TODO: Type musicmetadata
|
||||
__initialState?: PartialState;
|
||||
__customMiddlewares?: Middleware[];
|
||||
__butterchurnOptions?: ButterchurnOptions;
|
||||
@ -49,12 +47,17 @@ export interface PrivateOptions {
|
||||
__customMediaClass?: typeof Media; // This should have the same interface as Media
|
||||
}
|
||||
|
||||
export interface InjectableDependencies {
|
||||
requireJSZip: () => Promise<any>; // TODO: Type JSZip
|
||||
requireMusicMetadata: () => Promise<any>; // TODO: Type music-metadata-browser
|
||||
}
|
||||
|
||||
class Webamp {
|
||||
static VERSION = "1.5.0";
|
||||
_actionEmitter: Emitter;
|
||||
_root: ReactDOM.Root | null;
|
||||
_disposable: Disposable;
|
||||
options: Options & PrivateOptions; // TODO: Make this _private
|
||||
options: Options & PrivateOptions & InjectableDependencies; // TODO: Make this _private
|
||||
media: Media; // TODO: Make this _private
|
||||
store: Store; // TODO: Make this _private
|
||||
|
||||
@ -74,7 +77,7 @@ class Webamp {
|
||||
return supportsAudioApi && supportsCanvas && supportsPromises;
|
||||
}
|
||||
|
||||
constructor(options: Options & PrivateOptions) {
|
||||
constructor(options: Options & PrivateOptions & InjectableDependencies) {
|
||||
this._root = null;
|
||||
this._disposable = new Disposable();
|
||||
this._actionEmitter = new Emitter();
|
||||
|
Loading…
Reference in New Issue
Block a user