diff --git a/CHANGELOG.md b/CHANGELOG.md index f6ad52b8..a05fc215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## Next + +### Features + +- New Webamp instance method: `.setSkinFromUrl(url)`. See [usage.md](./docs/usage.md) for more details. + ## 1.4.0 ### Features diff --git a/docs/usage.md b/docs/usage.md index 0a5aac37..2a27fab7 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -375,6 +375,10 @@ const unsubscribe = webamp.onMinimize(() => { unsubscribe(); ``` +### `setSkinFromUrl(url: string): void` + +Updates the skin used by the webamp instance. Note that this does not happen immediately. If you want to be notified when the skin load is complete, use `.skinIsLoaded()`, which returns a promise which you can await. + ### `skinIsLoaded(): Promise` Returns a promise that resolves when the skin is done loading. diff --git a/index.d.ts b/index.d.ts index a0be4c30..fc56e57a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -250,6 +250,8 @@ export default class Webamp { */ public onMinimize(callback: () => any): () => void; + public setSkinFromUrl(url: string): void; + /** * Returns a promise that resolves when the skin is done loading. */ diff --git a/js/webampLazy.tsx b/js/webampLazy.tsx index f405967f..f5f0c818 100644 --- a/js/webampLazy.tsx +++ b/js/webampLazy.tsx @@ -387,6 +387,10 @@ class Winamp { return this._actionEmitter.on(MINIMIZE_WINAMP, cb); } + setSkinFromUrl(url: string): void { + this.store.dispatch(Actions.setSkinFromUrl(url)); + } + async skinIsLoaded(): Promise { // Wait for the skin to load. // TODO #leak