import React from 'react'; import noalbumart from '../assets/img/noalbumart.png'; import Emitter from '../melodii/Events'; export default class AlbumArt extends React.Component { constructor() { super(); this.state = {albumArt: noalbumart}; this.handleEvents(); } shouldComponentUpdate(nextprops, nextState) { return this.state.albumArt !== nextState.albumArt; } render() { console.log("Album Art Updated"); return (
Album-Art
); } /** * @listens Song#updateAlbumArt Updates Album Art */ handleEvents() { Emitter.on('updateAlbumArt', (blob, err) => { if (err) throw err; this.setState({albumArt: blob}); }); } }