feat: migration to TypeScript part 3

Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
JellyBrick
2023-09-03 21:02:57 +09:00
parent 03c1ab0e98
commit 278618bc83
25 changed files with 674 additions and 380 deletions

View File

@ -7,9 +7,10 @@ import { YoutubePlayer } from '../types/youtube-player';
import { GetState } from '../types/datahost-get-state';
let songInfo: SongInfo = {} as SongInfo;
export const getSongInfo = () => songInfo;
const $ = <E extends HTMLElement>(s: string): E => document.querySelector(s) as E;
const $$ = <E extends HTMLElement>(s: string): E[] => [...document.querySelectorAll(s)!] as E[];
const $$ = <E extends HTMLElement>(s: string): E[] => Array.from(document.querySelectorAll(s));
ipcRenderer.on('update-song-info', async (_, extractedSongInfo: string) => {
songInfo = JSON.parse(extractedSongInfo) as SongInfo;

View File

@ -9,16 +9,16 @@ export interface SongInfo {
title: string;
artist: string;
views: number;
uploadDate: string;
uploadDate?: string;
imageSrc?: string | null;
image?: Electron.NativeImage | null;
isPaused?: boolean;
songDuration: number;
elapsedSeconds: number;
url: string;
elapsedSeconds?: number;
url?: string;
album?: string | null;
videoId: string;
playlistId: string;
playlistId?: string;
}
// Fill songInfo with empty values