I'm also seeing same requirement from download API, though not sure what is the 
best way to do it yet.
I guess it is pretty natural that device APIs such as tizen.systeminfo, 
tizen.download, tizen.time etc to be read-only to users.

Maybe we can provide a general function to set an API to const in t-e-c.

Regards,
Deqing

From: [email protected] 
[mailto:[email protected]] On Behalf Of Huo, 
Halton
Sent: Friday, September 13, 2013 4:42 PM
To: [email protected]; Oliveira, Caio
Subject: [Crosswalk-dev] How to mark read-only for root of a extension

Hi Caio,

Some Tizen device API specs need mark the root element read-only, for eg 
SystemInfo<https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/systeminfo.html>,
 
Notification<https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/notification.html>
 , 
Bluetooth<https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/bluetooth.html>
 etc. Guanxian try below code at very beginning in system_info_api.js, but it 
will cause tizen.systeminfo keep stays as null (exports.xxx seems does take 
affect).

So any idea or hint?

if (typeof tizen === "undefined") {
  tizen = new Object();
}
_addConstProperty(tizen, "systeminfo", null);

function _addConstProperty(obj, propertyKey, propertyValue) {
  Object.defineProperty(obj, propertyKey, {
    configurable: false,
    writable: false,
    value: propertyValue
  });
}


Thanks,
Halton.
_______________________________________________
Crosswalk-dev mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

Reply via email to