Add a method to set the skin (#787)

Fixes #733
This commit is contained in:
Jordan Eldredge 2019-05-21 07:58:18 -07:00 committed by GitHub
parent b4a88d2cc4
commit 29b4e0db71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 0 deletions

View file

@ -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

View file

@ -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<void>`
Returns a promise that resolves when the skin is done loading.

2
index.d.ts vendored
View file

@ -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.
*/

View file

@ -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<void> {
// Wait for the skin to load.
// TODO #leak