issue #10 서브,컨텐트 빠르게 이동시 검은색 화면 출력 화면 개선. 상단 날씨 위젯 전용 API적용.

This commit is contained in:
Paul Kim
2023-03-18 17:57:17 +09:00
parent 29efea9b97
commit 0a8b413bce
4 changed files with 142 additions and 34 deletions

View File

@@ -19,6 +19,7 @@ var g_tm_prev = {
"news": null,
"epg": null,
"weather": null,
"widget": null,
"flight": null,
"report": null,
};
@@ -42,6 +43,7 @@ function __svcfxn_get_api_url(api_type) {
"get_news": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/news",
"get_epg": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/epg",
"get_weather": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/weather",
"get_widget": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/widget",
"get_flight": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/flight",
}
@@ -126,6 +128,7 @@ async function sworker_service(args) {
"news": false,
"flight": false,
"weather": false,
"widget": false,
"report": false,
};
let _tm_cur = new Date();
@@ -206,13 +209,25 @@ async function sworker_service(args) {
let _tm_diff_s = Math.floor(_tm_diff_ms / 1000);
//WEATHER정보는 매 2시간 마다 한번씩 업데이트
if (_tm_diff_s > 7200) {
//if (_tm_diff_s > 7200) {
if (_tm_diff_s > 60) {
g_tm_prev.weather = _tm_cur;
_bNeed_Update.weather = true;
}
}
// CHECK WIDGET INFORMATION UPDATE
if (g_tm_prev.widget != null) {
let _tm_diff_ms = _tm_cur.getTime() - g_tm_prev.weather.getTime();
let _tm_diff_s = Math.floor(_tm_diff_ms / 1000);
//WEATHER정보는 매 1시간 마다 한번씩 업데이트
//if (_tm_diff_s > 3600) {
if (_tm_diff_s > 60) {
g_tm_prev.widget = _tm_cur;
_bNeed_Update.widget = true;
}
}
@@ -245,14 +260,23 @@ async function sworker_service(args) {
}
if (_bNeed_Update.weather == true) {
let sz_api_url = __svcfxn_get_api_url("get_flight");
__svcfxn_CallCmsApi(sz_api_url, "GetFlight", null).then(_result => {
let sz_api_url = __svcfxn_get_api_url("get_weather");
__svcfxn_CallCmsApi(sz_api_url, "GetWeather", null).then(_result => {
g_port.postMessage({ "event": "update_weather", "ret": "OK", "data": JSON.parse(_result.data) });
}).catch(_error => {
g_port.postMessage({ "event": "update_weather", "ret": "ERROR", "data": null });
});
}
if (_bNeed_Update.widget == true) {
let sz_api_url = __svcfxn_get_api_url("get_widget");
__svcfxn_CallCmsApi(sz_api_url, "GetWidget", null).then(_result => {
g_port.postMessage({ "event": "update_widget", "ret": "OK", "data": JSON.parse(_result.data) });
}).catch(_error => {
g_port.postMessage({ "event": "update_widget", "ret": "ERROR", "data": null });
});
}
if (_bNeed_Update.report == true) {
g_port.postMessage({ "event": "update_report", "ret": "OK", "data": _bNeed_Update.report });
}