global.webapis.getPackageId = () => {
return this.packageId;
}
+ this.initProductWebapis();
+ }
+
+ initProductWebapis() {
+ // for TV profile
+ if (wrt.tv && !global.webapis.productinfo) {
+ global.webapis.cachedProperty = global.webapis.cachedProperty ?? {};
+ let getCachedValue = (name: string) => {
+ if (global.webapis.cachedProperty[name]) {
+ return global.webapis.cachedProperty[name];
+ }
+ let tv = wrt.tv as NativeWRTjs.TVExtension;
+ return (global.webapis.cachedProperty[name] = tv.queryProductValue(name));
+ }
+ global.webapis.productinfo = {
+ getDuid: () => {
+ return getCachedValue('getDuid');
+ },
+ getFirmware: () => {
+ return getCachedValue('getFirmware');
+ },
+ getLocalSet: () => {
+ return getCachedValue('getLocalSet');
+ },
+ getModel: () => {
+ return getCachedValue('getModel');
+ },
+ getModelCode: () => {
+ return getCachedValue('getModelCode');
+ },
+ getRealModel: () => {
+ return getCachedValue('getRealModel');
+ },
+ getSmartTVServerVersion: () => {
+ return getCachedValue('getSmartTVServerVersion');
+ }
+ };
+ }
}
initAccessControlManager() {