36 lines
812 B
TypeScript
36 lines
812 B
TypeScript
import { Action, createAction } from "redux-act";
|
|
|
|
export interface Title {
|
|
name: string;
|
|
artist: string;
|
|
album: string;
|
|
/**
|
|
* The length of the title in nanoseconds.
|
|
*/
|
|
length: number;
|
|
}
|
|
|
|
export interface MusicState {
|
|
muted: boolean;
|
|
playing: boolean;
|
|
title: Title;
|
|
playTime: number;
|
|
source?: string;
|
|
}
|
|
|
|
export const setTitle: (title: Title) => Action<null, null> = createAction(
|
|
"set currently playing title"
|
|
);
|
|
|
|
export const setPlayTime: (time: number) => Action<null, null> = createAction(
|
|
"set the play time"
|
|
);
|
|
|
|
export const toggleMute: () => Action<null, null> = createAction("toggle mute");
|
|
|
|
export const togglePlay: () => Action<null, null> = createAction("toggle play");
|
|
|
|
export const setSource: (source: string) => Action<null, null> = createAction(
|
|
"set the title"
|
|
);
|