media_player_client/src/common/Common.ts

32 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-08-05 14:23:45 +08:00
export namespace Common {
2021-08-06 10:54:03 +08:00
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"],
2022-01-24 16:06:16 +08:00
["EwindowType::Clock", "img:source_icon/clock.png"],
2021-08-06 10:54:03 +08:00
["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";
}
};
}