WidgetData API
To use Samsung Product API,
<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>
Should be loaded in index.html
Since : 2.3
Product : TV, AV_BD, B2B (LFD, IWB)
Privilege level: public
Privilege: http://developer.samsung.com/privilege/widgetdata
Summary of Interfaces and Methods
Interface | Method |
---|---|
WidgetDataManagerObject | |
WidgetDataManager | DOMString getVersion () void read (SuccessCallback onsuccess, optional ErrorCallback ? onerror) void write (DOMString data, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror) void remove (optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror) |
1. Interfaces
1.1. WidgetDataManagerObject
The webapis.widgetdata object enables access to WidgetData API functionality.
[NoInterfaceObject]interface WidgetDataManagerObject {
readonly attribute WidgetDataManager widgetdata;
};
WebApi implements WidgetDataManagerObject;
Attributes
- readonly WidgetDataManager widgetdata
WidgetData API namespace
1.2. WidgetDataManager
[NoInterfaceObject]interface WidgetDataManager {
[NoInterfaceObject]interface WidgetDataManager {
DOMString getVersion();
void read(SuccessCallback onsuccess, optional ErrorCallback ? onerror);
void write(DOMString data, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
void remove(optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
};
Methods
getVersion
-
Retrieves the plugin version number.
DOMString getVersion();
Since : 2.3
Product : TV, AV_BD, B2B (LFD, IWB)
Privilege level: public
Privilege: http://developer.samsung.com/privilege/widgetdata
Return value:
DOMString Plugin versionExceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
Code example:
try { var value = webapis.widgetdata.getVersion(); console.log(" version value = " + value); } catch (error) { console.log(" error code = " + error.code); }
- WebAPIException
read
-
Reads encrypted data.
void read(SuccessCallback onsuccess, optional ErrorCallback ? onerror);
Since : 4.0
Product : TV, AV_BD, B2B (LFD, IWB)
Privilege level: public
Privilege: http://developer.samsung.com/privilege/widgetdata
Parameters:
- onsuccess: Callback method to invoke when the data is successfully read
- onerror [optional]: Callback method to invoke if an error occurs
- NotFoundError, if no file was found in the local path.
- SecurityError, if the application does not have the privilege to call this method.
- UnknownError, if any other error occurs.
Exceptions:
- WebAPIException
-
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
-
Code example:
function onsuccess(data) { console.log("success read :" + data); } function onerror(error) { console.log("error code : " + error.code); } try { webapis.widgetdata.read(onsuccess, onerror); } catch (error) { console.log(" error code = " + error.code); }
write
-
Writes encrypted data.
void write(DOMString data, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
Since : 4.0
Product : TV, AV_BD, B2B (LFD, IWB)
Privilege level: public
Privilege: http://developer.samsung.com/privilege/widgetdata
Parameters:
- data: Data, up to 20000 characters
- onsuccess [optional]: Callback method to invoke when the data is successfully written
- onerror [optional]: Callback method to invoke if an error occurs
- DOMStringSizeError, if any of the input parameters exceeds the limited size.
- SecurityError, if the application does not have the privilege to call this method.
- UnknownError, if any other error occurs.
Exceptions:
- WebAPIException
-
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
-
Code example:
function onsuccess() { console.log("success write"); } function onerror(error) { console.log("error code : " + error.code); } try { var data = "STRING DATA"; webapis.widgetdata.write(data, onsuccess, onerror); } catch (error) { console.log(" error code = " + error.code); }
remove
-
Removes encrypted data.
void remove(optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
Since : 4.0
Product : TV, AV_BD, B2B (LFD, IWB)
Privilege level: public
Privilege: http://developer.samsung.com/privilege/widgetdata
Parameters:
- onsuccess [optional]: Callback method to invoke when the data is successfully removed
- onerror [optional]: Callback method to invoke if an error occurs
- NotFoundError, if no file was found in the local path.
- SecurityError, if the application does not have the privilege to call this method.
- UnknownError, if any other error occurs.
Exceptions:
- WebAPIException
-
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
-
Code example:
function onsuccess() { console.log("success remove"); } function onerror(error) { console.log("error code : " + error.code); } try { webapis.widgetdata.remove(onsuccess, onerror); } catch (error) { console.log(" error code = " + error.code); }
2. Full WebIDL
module WidgetData {
[NoInterfaceObject]interface WidgetDataManagerObject {
readonly attribute WidgetDataManager widgetdata;
};
WebApi implements WidgetDataManagerObject;
[NoInterfaceObject]interface WidgetDataManager {
DOMString getVersion();
void read(SuccessCallback onsuccess, optional ErrorCallback ? onerror);
void write(DOMString data, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
void remove(optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
};
};