tidal-hifi/src/scripts/mediaInfo.js

26 lines
542 B
JavaScript
Raw Normal View History

const mediaInfo = {
title: "",
artist: "",
icon: "",
};
const mediaInfoModule = {
mediaInfo,
};
mediaInfoModule.update = function(arg) {
mediaInfo.title = propOrDefault(arg.title);
mediaInfo.artist = propOrDefault(arg.message);
mediaInfo.icon = propOrDefault(arg.icon);
};
/**
* Return the property or a default value
* @param {*} prop property to check
* @param {*} defaultValue defaults to ""
*/
function propOrDefault(prop, defaultValue = "") {
return prop ? prop : defaultValue;
}
module.exports = mediaInfoModule;