mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-10-30 01:49:03 +01:00
26 lines
542 B
JavaScript
26 lines
542 B
JavaScript
|
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;
|