top

WebApi API

To use Samsung Product API, 

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

Should be loaded in index.html

The module defines the functionalities that are provides as the Samsung TV for Tizen Platform Product API. Additionally, this API specifies the location in the ECMAScript hierarchy in which the Samsung TV for Tizen Platform Product API is instantiated (window.webapis).

Since : 1.0

Table of Contents

  1. 1. Interfaces
    1. 1.1. WebApiObject
    2. 1.2. WebApi
    3. 1.3. WebAPIException
    4. 1.4. WebAPIError
    5. 1.5. SuccessCallback
    6. 1.6. ErrorCallback
  2. 2. Full WebIDL

Summary of Interfaces and Methods

Interface Method
WebApiObject  
WebApi  
WebAPIException  
WebAPIError  
SuccessCallback void onsuccess ()
ErrorCallback void onerror (WebAPIError error)

1. Interfaces

1.1. WebApiObject

This interface defines the webapis interface as a part of the window global object.

  [NoInterfaceObject] interface WebApiObject {
      readonly attribute WebApi webapis;
  };

  Window implements WebApiObject;

Since : 1.0

Attributes

  • readonly WebApi webapis
    This attribute defines global namespace for Samsung TV for Tizen Platform Product API.

    Since : 1.0

1.2. WebApi

This interface defines the root of Product API.

  [NoInterfaceObject]interface WebApi {};

Since : 1.0

1.3. WebAPIException

This interface defines Exception errors of  synchronous APIs.

  [NoInterfaceObject]interface WebAPIException {
      readonly attribute unsigned short code;
      readonly attribute DOMString name;
      readonly attribute DOMString message;

      const unsigned short INDEX_SIZE_ERR = 1;
      const unsigned short DOMSTRING_SIZE_ERR = 2;
      const unsigned short HIERARCHY_REQUEST_ERR = 3;
      const unsigned short WRONG_DOCUMENT_ERR = 4;
      const unsigned short INVALID_CHARACTER_ERR = 5;
      const unsigned short NO_DATA_ALLOWED_ERR = 6;
      const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
      const unsigned short NOT_FOUND_ERR = 8;
      const unsigned short NOT_SUPPORTED_ERR = 9;
      const unsigned short INUSE_ATTRIBUTE_ERR = 10;
      const unsigned short INVALID_STATE_ERR = 11;
      const unsigned short SYNTAX_ERR = 12;
      const unsigned short INVALID_MODIFICATION_ERR = 13;
      const unsigned short NAMESPACE_ERR = 14;
      const unsigned short INVALID_ACCESS_ERR = 15;
      const unsigned short VALIDATION_ERR = 16;
      const unsigned short TYPE_MISMATCH_ERR = 17;
      const unsigned short SECURITY_ERR = 18;
      const unsigned short NETWORK_ERR = 19;
      const unsigned short ABORT_ERR = 20;
      const unsigned short URL_MISMATCH_ERR = 21;
      const unsigned short QUOTA_EXCEEDED_ERR = 22;
      const unsigned short TIMEOUT_ERR = 23;
      const unsigned short INVALID_NODE_TYPE_ERR = 24;
      const unsigned short DATA_CLONE_ERR = 25;
      const unsigned short INVALID_VALUES_ERR = 26;
      const unsigned short IO_ERR = 27;
      const unsigned short SERVICE_NOT_AVAILABLE_ERR = 28;
      const unsigned short UNKNOW_ERR = 9999;
  };

Since : 1.0

Constants

  • INDEX_SIZE_ERR

    Since : 1.0


     
  • DOMSTRING_SIZE_ERR

    Since : 1.0


     
  • HIERARCHY_REQUEST_ERR

    Since : 1.0


     
  • WRONG_DOCUMENT_ERR

    Since : 1.0


     
  • INVALID_CHARACTER_ERR

    Since : 1.0


     
  • NO_DATA_ALLOWED_ERR

    Since : 1.0


     
  • NO_MODIFICATION_ALLOWED_ERR

    Since : 1.0


     
  • NOT_FOUND_ERR

    Since : 1.0


     
  • NOT_SUPPORTED_ERR

    Since : 1.0


     
  • INUSE_ATTRIBUTE_ERR

    Since : 1.0


     
  • INVALID_STATE_ERR

    Since : 1.0


     
  • SYNTAX_ERR

    Since : 1.0


     
  • INVALID_MODIFICATION_ERR

    Since : 1.0


     
  • NAMESPACE_ERR

    Since : 1.0


     
  • INVALID_ACCESS_ERR

    Since : 1.0


     
  • VALIDATION_ERR

    Since : 1.0


     
  • TYPE_MISMATCH_ERR

    Since : 1.0


     
  • SECURITY_ERR

    Since : 1.0


     
  • NETWORK_ERR

    Since : 1.0


     
  • ABORT_ERR

    Since : 1.0


     
  • URL_MISMATCH_ERR

    Since : 1.0


     
  • QUOTA_EXCEEDED_ERR

    Since : 1.0


     
  • TIMEOUT_ERR

    Since : 1.0


     
  • INVALID_NODE_TYPE_ERR

    Since : 1.0


     
  • DATA_CLONE_ERR

    Since : 1.0


     
  • INVALID_VALUES_ERR

    Since : 1.0


     
  • DATA_CLONE_ERR

    Since : 1.0


     
  • INVALID_VALUES_ERR

    Since : 1.0


     
  • IO_ERR

    Since : 1.0


     
  • SERVICE_NOT_AVAILABLE_ERR

    Since : 1.0


     
  • UNKNOW_ERR

    Since : 1.0


     

Attributes

  • readonly unsigned short code
    This attribute defines value of error code. 

    Since : 1.0

  • readonly DOMString name
    This attribute defines value of error name. An error type.

    Since : 1.0

  • readonly DOMString message
    This attribute defines value of error message. An error message that describes the details of the error encountered.

    Since : 1.0

1.4. WebAPIError

This interface defines error of  asynchronous APIs.

  [NoInterfaceObject]interface WebAPIError {
      readonly attribute unsigned short code;
      readonly attribute DOMString name;
      readonly attribute DOMString message;
  };

Since : 1.0

Attributes

  • readonly unsigned short code
    This attribute defines value of error code.

    Since : 1.0

  • readonly DOMString name
    This attribute defines value of error name. An error type.

    Since : 1.0

  • readonly DOMString message
    This attribute defines value of error message. An error message that describes the details of the error encountered.

    Since : 1.0

1.5. SuccessCallback

This callback interface is used in methods that do not require any return value in the success callback.

[Callback = FunctionOnly, NoInterfaceObject]
  interface SuccessCallback {
      void onsuccess();
  };

Since : 1.0

Methods

onsuccess
This callback interface is used in methods that do not require any return value in the success callback.

  void onsuccess();
             

Since : 1.0

Code example:


  function onsuccess()
  {
      console.log("success");
  }

1.6. ErrorCallback

This callback interface is used in methods that do not require any return value in the error callback. 

  [Callback = FunctionOnly, NoInterfaceObject]
  interface ErrorCallback {
      void onerror(WebAPIError error);
  };

Since : 1.0

Methods

onerror
This callback interface is used in methods that do not require any return value in the error callback. 

  void onerror(WebAPIError error);
             

Since : 1.0

Parameters:

  • error: WebAPIError

Code example:


  function onerror(error)
  {
      console.log("error code : " + error.code);
  }

2. Full WebIDL


  module WebApi {
      [NoInterfaceObject]interface WebApiObject {
          readonly attribute WebApi webapis;
      };
      Window implements WebApiObject;

      [NoInterfaceObject]interface WebApi {};

      [NoInterfaceObject]interface WebAPIException {
          readonly attribute unsigned short code;
          readonly attribute DOMString name;
          readonly attribute DOMString message;

          const unsigned short INDEX_SIZE_ERR = 1;
          const unsigned short DOMSTRING_SIZE_ERR = 2;
          const unsigned short HIERARCHY_REQUEST_ERR = 3;
          const unsigned short WRONG_DOCUMENT_ERR = 4;
          const unsigned short INVALID_CHARACTER_ERR = 5;
          const unsigned short NO_DATA_ALLOWED_ERR = 6;
          const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
          const unsigned short NOT_FOUND_ERR = 8;
          const unsigned short NOT_SUPPORTED_ERR = 9;
          const unsigned short INUSE_ATTRIBUTE_ERR = 10;
          const unsigned short INVALID_STATE_ERR = 11;
          const unsigned short SYNTAX_ERR = 12;
          const unsigned short INVALID_MODIFICATION_ERR = 13;
          const unsigned short NAMESPACE_ERR = 14;
          const unsigned short INVALID_ACCESS_ERR = 15;
          const unsigned short VALIDATION_ERR = 16;
          const unsigned short TYPE_MISMATCH_ERR = 17;
          const unsigned short SECURITY_ERR = 18;
          const unsigned short NETWORK_ERR = 19;
          const unsigned short ABORT_ERR = 20;
          const unsigned short URL_MISMATCH_ERR = 21;
          const unsigned short QUOTA_EXCEEDED_ERR = 22;
          const unsigned short TIMEOUT_ERR = 23;
          const unsigned short INVALID_NODE_TYPE_ERR = 24;
          const unsigned short DATA_CLONE_ERR = 25;
          const unsigned short INVALID_VALUES_ERR = 26;
          const unsigned short IO_ERR = 27;
          const unsigned short SERVICE_NOT_AVAILABLE_ERR = 28;
          const unsigned short UNKNOW_ERR = 9999;
      };

      [NoInterfaceObject]interface WebAPIError {
          readonly attribute unsigned short code;
          readonly attribute DOMString name;
          readonly attribute DOMString message;
      };

      [Callback = FunctionOnly, NoInterfaceObject]
      interface SuccessCallback {
          void onsuccess();
      };

      [Callback = FunctionOnly, NoInterfaceObject]
      interface ErrorCallback {
          void onerror(WebAPIError error);
      };

  };