From 5172c7c332f15f9f91fabbcd412d43dcc723ae6d Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Fri, 4 Mar 2022 10:20:55 +0900 Subject: [PATCH] [Service][VD] Add webapis.getPreviewData() This provides preview tiles data for DeviceHome service. Related chromium-efl patch: https://review.tizen.org/gerrit/269316/ Change-Id: I2c4df503ab1791a63768bd5effdd82f99ad9fdca Signed-off-by: DongHyun Song --- wrt_app/service/device_api_router.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index b0a2b6d..5f30ad0 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -56,11 +56,23 @@ export class DeviceAPIRouter { global.webapis.postPlainNotification = (title: string, message: string, timeout?: number) => { return wrt.postPlainNotification(title, message, timeout ?? 10); } + global.webapis.getPreviewData = (packageId: string) => { + try { + if (wrt.tv) + return wrt.tv.getPreviewData(packageId); + else + throw 'This API is only for TV profile'; + } catch(e) { + console.debug(`wrt.tv.getPreviewData('${packageId}') failed, ${e}`); + return { images: 'no' }; + } + } Object.defineProperties(global.webapis, { getCallerAppId: { writable: false, enumerable: true }, getPackageId: { writable: false, enumerable: true }, getServiceId: { writable: false, enumerable: true }, postPlainNotification: { writable: false, enumerable: true }, + getPreviewData: { writable: false, enumerable: true }, }); this.initMDEWebapis(); this.initEdgeWebapis(); -- 2.7.4