media_player_client/src/common/Common.ts

31 lines
1.0 KiB
TypeScript

export namespace Common {
export const waitFor = async (ms: number) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(null);
}, ms);
});
};
export const getSignalSourceIcon = (item_type: string) => {
let icon_map = new Map([
["EwindowType::Normal", "img:source_icon/hdmi.png"],
["EwindowType::Multimedia", "img:source_icon/media.png"],
["EwindowType::Web", "img:source_icon/web.png"],
["EwindowType::Image", "img:source_icon/image.png"],
["EwindowType::Pdf", "img:source_icon/pdf.png"],
["EwindowType::Ppt", "img:source_icon/ppt.png"],
["EwindowType::Rtsp", "img:source_icon/rtsp.png"],
["EwindowType::Subtitles", "img:source_icon/subtitles.png"],
["EwindowType::Weather", "img:source_icon/weather.png"],
["EwindowType::HdmiIn", "img:source_icon/hdmi.png"],
]);
if (icon_map.has(item_type)) {
return icon_map.get(item_type);
} else {
return "img:source_icon/hdmi.png";
}
};
}