top

WebApi 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 functionalities provided by the Tizen Samsung TV Product API.
Additionally, this specifies the location in the ECMAScript hierarchy in which the Tizen Samsung TV Product API is instantiated (window.webapis).

Since : 2.3

Product : TV, AV_BD

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;

Attributes

  • readonly WebApi webapis
    Namespace for webapis.

1.2. WebApi

This interface defines the root of Tizen Samsung TV Product API.

[NoInterfaceObject]interface WebApi {};

1.3. WebAPIException

This interface defines Exception errors of APIs.

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

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

Constants

  • INDEX_SIZE_ERR
    The index is not in the allowed range.
  • DOMSTRING_SIZE_ERR
    The specified range of text is too large.
  • HIERARCHY_REQUEST_ERR
    The operation would yield an incorrect node tree.
  • WRONG_DOCUMENT_ERR
    The object is in the wrong document.
  • INVALID_CHARACTER_ERR
    The string contains invalid characters.
  • NO_DATA_ALLOWED_ERR
    Data is specified for a node that does not support data.
  • NO_MODIFICATION_ALLOWED_ERR
    The object cannot be modified.
  • NOT_FOUND_ERR
    The object cannot be found here.
  • NOT_SUPPORTED_ERR
    The operation is not supported.
  • INUSE_ATTRIBUTE_ERR
    The specified attribute is already in use elsewhere.
  • INVALID_STATE_ERR
    The object is in an invalid state.
  • SYNTAX_ERR
    The string did not match the expected pattern.
  • INVALID_MODIFICATION_ERR
    The object cannot be modified in this way.
  • NAMESPACE_ERR
    The operation is not allowed by Namespaces in XML.
  • INVALID_ACCESS_ERR
    The object does not support the operation or argument.
  • VALIDATION_ERR
    The operation would cause the node to fail validation.
  • TYPE_MISMATCH_ERR
    The type of the object does not match the expected type.
  • SECURITY_ERR
    The operation is insecure.
  • NETWORK_ERR
    A network error occurred.
  • ABORT_ERR
    The operation has been aborted.
  • URL_MISMATCH_ERR
    The given URL does not match another URL.
  • QUOTA_EXCEEDED_ERR
    The quota has been exceeded.
  • TIMEOUT_ERR
    The operation has timed out.
  • INVALID_NODE_TYPE_ERR
    The supplied node is incorrect or has an incorrect ancestor for this operation.
  • DATA_CLONE_ERR
    The object cannot be cloned.
  • INVALID_VALUES_ERR
    Input parameters contain an invalid value
  • IO_ERR
    IOs have error.
  • SERVICE_NOT_AVAILABLE_ERR
    Service is not available error.
  • UNKNOW_ERR
    This means an unknown error.

Attributes

  • readonly unsigned short code
    An error code value
  • readonly DOMString name
    An error type name. The name attribute must return the value it had been initialized with.
  • readonly DOMString message
    An error message that describes the details of an encountered error.

1.4. WebAPIError

This interface will be used by the APIs in order to return them in the error callback of asynchronous methods.

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

Attributes

  • readonly unsigned short code
    An error code value
  • readonly DOMString name
    An error type name. The name attribute must return the value it had been initialized with.
  • readonly DOMString message
    An error message that describes the details of an encountered error.

1.5. SuccessCallback

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

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

Methods

onsuccess
Method invoked when the asynchronous call completes successfully.

void onsuccess();

Since : 2.3

Product : TV, AV_BD

Code example:


function onsuccess()
{
  console.log("Success Callback is called.");
}

1.6. ErrorCallback

This interface is used in methods that require only an error as an input parameter in the error callback.

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

Methods

onerror
Method that is invoked when an error occurs.

void onerror(WebAPIError error);

Since : 2.3

Product : TV, AV_BD

Parameters:

  • error: Generic error

Code example:


function onerror(error)
{
  console.log(error.message);
}

2. Full WebIDL


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

  Window implements WebApiObject;

  [NoInterfaceObject]interface WebApi {};

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

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

  [NoInterfaceObject]interface WebAPIError {
    readonly attribute unsigned long 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);
  };
};