mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Sketch out open/close window methods
This commit is contained in:
parent
9d4f71546a
commit
1fead0799d
6 changed files with 33 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ export {
|
|||
toggleDoubleSizeMode,
|
||||
toggleEqualizerShadeMode,
|
||||
togglePlaylistShadeMode,
|
||||
openWindow,
|
||||
closeWindow,
|
||||
hideWindow,
|
||||
showWindow,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {
|
|||
WINDOW_SIZE_CHANGED,
|
||||
TOGGLE_WINDOW,
|
||||
CLOSE_WINDOW,
|
||||
OPEN_WINDOW,
|
||||
TOGGLE_WINDOW_SHADE_MODE,
|
||||
SET_WINDOW_VISIBILITY,
|
||||
BROWSER_WINDOW_SIZE_CHANGED,
|
||||
|
|
@ -88,6 +89,10 @@ export function closeWindow(windowId: WindowId): Action {
|
|||
return { type: CLOSE_WINDOW, windowId };
|
||||
}
|
||||
|
||||
export function openWindow(windowId: WindowId): Action {
|
||||
return { type: OPEN_WINDOW, windowId };
|
||||
}
|
||||
|
||||
export function hideWindow(windowId: WindowId): Action {
|
||||
return { type: SET_WINDOW_VISIBILITY, windowId, hidden: true };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ export const SET_MEDIA_TAGS = "SET_MEDIA_TAGS";
|
|||
export const SET_MEDIA_DURATION = "SET_MEDIA_DURATION";
|
||||
export const TOGGLE_WINDOW = "TOGGLE_WINDOW";
|
||||
export const CLOSE_WINDOW = "CLOSE_WINDOW";
|
||||
export const OPEN_WINDOW = "CLOSE_WINDOW";
|
||||
export const MEDIA_TAG_REQUEST_INITIALIZED = "MEDIA_TAG_REQUEST_INITIALIZED";
|
||||
export const MEDIA_TAG_REQUEST_FAILED = "MEDIA_TAG_REQUEST_FAILED";
|
||||
export const NETWORK_CONNECTED = "NETWORK_CONNECTED";
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {
|
|||
SET_FOCUSED_WINDOW,
|
||||
TOGGLE_WINDOW,
|
||||
CLOSE_WINDOW,
|
||||
OPEN_WINDOW,
|
||||
SET_WINDOW_VISIBILITY,
|
||||
UPDATE_WINDOW_POSITIONS,
|
||||
WINDOW_SIZE_CHANGED,
|
||||
|
|
@ -171,6 +172,18 @@ const windows = (
|
|||
},
|
||||
},
|
||||
};
|
||||
case OPEN_WINDOW:
|
||||
return {
|
||||
...state,
|
||||
genWindows: {
|
||||
...state.genWindows,
|
||||
[action.windowId]: {
|
||||
...state.genWindows[action.windowId],
|
||||
open: false,
|
||||
hidden: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
case SET_WINDOW_VISIBILITY:
|
||||
return {
|
||||
...state,
|
||||
|
|
|
|||
|
|
@ -383,6 +383,10 @@ export type Action =
|
|||
type: "CLOSE_WINDOW";
|
||||
windowId: WindowId;
|
||||
}
|
||||
| {
|
||||
type: "OPEN_WINDOW";
|
||||
windowId: WindowId;
|
||||
}
|
||||
| {
|
||||
type: "SET_WINDOW_VISIBILITY";
|
||||
windowId: WindowId;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
WindowPosition,
|
||||
ButterchurnOptions,
|
||||
Action,
|
||||
WindowId,
|
||||
} from "./types";
|
||||
import getStore from "./store";
|
||||
import App from "./components/App";
|
||||
|
|
@ -390,6 +391,14 @@ class Winamp {
|
|||
return this._actionEmitter.on(MINIMIZE_WINAMP, cb);
|
||||
}
|
||||
|
||||
closeWindow(id: WindowId) {
|
||||
this.store.dispatch(Actions.closeWindow(id));
|
||||
}
|
||||
|
||||
openWindow(id: WindowId) {
|
||||
this.store.dispatch(Actions.openWindow(id));
|
||||
}
|
||||
|
||||
setSkinFromUrl(url: string): void {
|
||||
this.store.dispatch(Actions.setSkinFromUrl(url));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue