From 3b4a66f2fe943c6485fb2e25903efd04bae6d0ad Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 29 Apr 2019 06:41:09 -0700 Subject: [PATCH] Allow users to customize the media class --- js/webampLazy.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/webampLazy.tsx b/js/webampLazy.tsx index 6ce750d3..2bbe5d76 100644 --- a/js/webampLazy.tsx +++ b/js/webampLazy.tsx @@ -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,