Add method to reopen Webamp

This commit is contained in:
Jordan Eldredge 2018-11-10 21:22:44 -08:00
parent 19db61ccf9
commit 47ba520c24
5 changed files with 16 additions and 0 deletions

View file

@ -1,5 +1,6 @@
import {
CLOSE_WINAMP,
OPEN_WINAMP,
STOP,
TOGGLE_VISUALIZER_STYLE,
CLOSE_REQUESTED,
@ -108,6 +109,10 @@ export function close(): Dispatchable {
};
}
export function open(): Dispatchable {
return { type: OPEN_WINAMP };
}
export function toggleVisualizerStyle(): Dispatchable {
return { type: TOGGLE_VISUALIZER_STYLE };
}

View file

@ -1,5 +1,6 @@
export const ADD_TRACK_FROM_URL = "ADD_TRACK_FROM_URL";
export const CLOSE_WINAMP = "CLOSE_WINAMP";
export const OPEN_WINAMP = "OPEN_WINAMP";
export const MINIMIZE_WINAMP = "MINIMIZE_WINAMP";
export const IS_PLAYING = "IS_PLAYING";
export const IS_STOPPED = "IS_STOPPED";

View file

@ -12,6 +12,7 @@ import { createSelector } from "reselect";
import {
CLOSE_WINAMP,
OPEN_WINAMP,
SET_SKIN_DATA,
START_WORKING,
STEP_MARQUEE,
@ -143,6 +144,8 @@ const display = (
return { ...state, working: true };
case CLOSE_WINAMP:
return { ...state, closed: true };
case OPEN_WINAMP:
return { ...state, closed: false };
case LOADING:
return { ...state, loading: true };
case LOADED:

View file

@ -253,6 +253,9 @@ export type Action =
| {
type: "CLOSE_WINAMP";
}
| {
type: "OPEN_WINAMP";
}
| {
type: "LOADING";
}

View file

@ -307,6 +307,10 @@ class Winamp {
return this._actionEmitter.on(CLOSE_WINAMP, cb);
}
reopen(): void {
this.store.dispatch(Actions.open());
}
onTrackDidChange(cb: (trackInfo: LoadedURLTrack | null) => void): () => void {
let previousTrackId: number | null = null;
return this.store.subscribe(() => {