This repository has been archived on 2022-09-16. You can view files and clone it, but cannot push or open issues/pull-requests.
2020-03-27 22:23:31 +00:00
|
|
|
import { Action, createAction } from "redux-act";
|
|
|
|
|
|
|
|
export interface Title {
|
2021-04-07 23:23:21 +01:00
|
|
|
name: string;
|
|
|
|
artist: string;
|
|
|
|
album: string;
|
|
|
|
/**
|
|
|
|
* The length of the title in nanoseconds.
|
|
|
|
*/
|
|
|
|
length: number;
|
2020-03-27 22:23:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface MusicState {
|
2021-04-07 23:23:21 +01:00
|
|
|
muted: boolean;
|
|
|
|
playing: boolean;
|
|
|
|
title: Title;
|
|
|
|
playTime: number;
|
|
|
|
source?: string;
|
2020-03-27 22:23:31 +00:00
|
|
|
}
|
|
|
|
|
2021-04-07 23:14:42 +01:00
|
|
|
export const setTitle: (_title: Title) => Action<null, null> = createAction(
|
2021-04-07 23:23:21 +01:00
|
|
|
"set currently playing title"
|
2020-03-27 22:23:31 +00:00
|
|
|
);
|
|
|
|
|
2022-08-01 21:43:50 +01:00
|
|
|
export const setPlayTime: (_time: number) => Action<null, null> =
|
|
|
|
createAction("set the play time");
|
2020-03-27 22:23:31 +00:00
|
|
|
|
|
|
|
export const toggleMute: () => Action<null, null> = createAction("toggle mute");
|
|
|
|
|
|
|
|
export const togglePlay: () => Action<null, null> = createAction("toggle play");
|
|
|
|
|
2022-08-01 21:43:50 +01:00
|
|
|
export const setSource: (_source: string) => Action<null, null> =
|
|
|
|
createAction("set the title");
|