GUIDE

GUIDE


WidgetData API

To use Samsung Product API, 


<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>


Should be loaded in index.html

This module defines the application secure storage functionalities provided by the Tizen Samsung Smart Signage Product API.

Since : 2.4

Product : SSSP

Privilege level: public

Privilege: http://developer.samsung.com/privilege/widgetdata

Table of Contents

  1. 1. Interfaces
    1. 1.1. WidgetDataManagerObject
    2. 1.2. WidgetDataManager
  2. 2. Full WebIDL

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

Defines a WebApi object instance of the Tizen Samsung Smart Signage Product API.
The webapis.widgetdata object enables access to WidgetData API functionality.

[NoInterfaceObject]interface WidgetDataManagerObject {
  readonly attribute WidgetDataManager widgetdata;
};

  WebApi implements WidgetDataManagerObject;

Attributes

1.2. WidgetDataManager

Provides methods for WidgetData functionalities.

  [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.4

Product : SSSP

Privilege level: public

Privilege: http://developer.samsung.com/privilege/widgetdata

Return value:

DOMString Plugin version

Exceptions:

  • 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);
}
read
Reads encrypted data.

void read(SuccessCallback onsuccess, optional ErrorCallback ? onerror);

Since : 4.0

Product : SSSP

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 : SSSP

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 : SSSP

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);
	  };
	};
	

위로가기