mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 02:51:46 +00:00
feat: migration to TypeScript part 3
Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user