Allow users to customize the media class

This commit is contained in:
Jordan Eldredge 2019-04-29 06:41:09 -07:00
parent c75214dcd7
commit 3b4a66f2fe

View file

@ -125,6 +125,7 @@ interface PrivateOptions {
};
};
__butterchurnOptions: ButterchurnOptions;
__customMediaClass: typeof Media; // This should have the same interface as Media
}
// Return a promise that resolves when the store matches a predicate.
@ -180,6 +181,7 @@ class Winamp {
requireMusicMetadata,
handleTrackDropEvent,
__butterchurnOptions,
__customMediaClass,
} = this.options;
// TODO: Make this much cleaner
@ -203,7 +205,7 @@ class Winamp {
// TODO: Validate required options
this.media = new Media();
this.media = new (__customMediaClass || Media)();
this.store = getStore(
this.media,
this._actionEmitter,