import { IPCInvokeHandler } from '../../shared/IPCHandler' ; import { AlbumArtResult } from '../../shared/interfaces/songDetails.interface' ; import * as needle from 'needle' ; import { serverURL } from '../../shared/Paths' ; /**
 * Handles the 'album-art' event.
 */ class AlbumArtHandler implements IPCInvokeHandler < 'album-art' > { event : 'album-art' = 'album-art' ; returns async handler ( songID ) { return new Promise < AlbumArtResult > ( ( resolve , reject ) => { needle . request ( 'get' , serverURL + `/api/data/albumArt` , { songID : songID } , ( err , response ) => { if ( err ) { reject ( err ) ; } else { resolve ( response . body ) ; } } ) ; } ) ; } } export const albumArtHandler = new AlbumArtHandler ( ) ;