The API provides the basic definitions that are used in the Tizen Web Device API. These include generic callbacks that are invoked when the operations succeed or fail, WebAPIError and WebAPIException that give information of the platform's error and filter interfaces that are used to make query statements for searching.
Additionally, this API specifies the location in the ECMAScript hierarchy in which the Tizen Web Device API is instantiated (window.tizen).
EXACTLY - Indicates that an attribute value should match exactly with the specified default value. For strings, this type of comparison is case-sensitive.
FULLSTRING - Indicates String-based comparison and that the attribute value should match the whole string (case insensitive).
CONTAINS - Indicates that an attribute value should contain the specified string. This type of comparison works only on strings and is case insensitive.
STARTSWITH - Indicates that an attribute value should start with the specified string. This type of comparison works only on strings and is case insensitive.
ENDSWITH - Indicates that an attribute value should end with the specified string. This type of comparison works only on strings and is case insensitive.
EXISTS - Indicates that a filter comparison should match if the specified attribute exists.
1.2. SortModeOrder
An enumerator that indicates the sorting order.
enum SortModeOrder { "ASC", "DESC" };
Since: 1.0
The following values are supported:
ASC - Indicates that the sorting order is ascending
DESC - Indicates that the sorting order is descending
1.3. CompositeFilterType
An enumerator that indicates the type of composite filter.
It represents the query statement for the specified value of matchValue by the rule of matchFlag.
If no matchValue is defined, the filter matches all objects that have the attribute defined (same as the "EXISTS" filter works), otherwise, it only matches objects which have an attribute that match the specified value.
Code example:
// The following example retrieves all songs from the album "The Joshua Tree".
var count = 100;
var offset = 0;
var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
function errorCB(err) {
console.log( 'The following error occurred: ' + err.name);
}
function findCB(contents) {
console.log('The Joshua Tree :' + contents.length);
}
tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
Constructors
AttributeFilter(DOMString attributeName, optional FilterMatchFlag? matchFlag, optional any matchValue);
Attributes
DOMString attributeName
The name of the object attribute used for filtering.
This is the name of the object attribute exactly as it is defined in the object's interface. For attributes of complex type, use fully-qualified names (such as 'geolocation.latitude' to filter a video or image content's latitude in a geolocation).
For attributes of an array type, the filter will match if any value in the array matches.
Since: 1.0
FilterMatchFlag matchFlag
The match flag used for attribute-based filtering.
By default, this attribute is set to "EXACTLY".
Since: 1.0
any matchValue
The value used for matching.
The filter will match if the attribute value matches the given matchValue. This value is not used if the matchFlag is set to "EXISTS". By default, this attribute is set to null.
Since: 1.0
2.5. AttributeRangeFilter
AttributeRangeFilter represents a filter based on an object attribute
which has values that are within a particular range.
[Constructor(DOMString attributeName, optional any initialValue, optional any endValue)] interface AttributeRangeFilter : AbstractFilter {
attribute DOMString attributeName;
attribute any initialValue;
attribute any endValue;
};
Since: 1.0
Range filters, where only one boundary is set, are available.
Code example:
var count = 100;
var offset = 0;
// Use the modifiedDate attribute with a range that starts today and ends in 1 day
// (meaning that you search for all contents modified today)
var today = new Date();
var today_begin = new Date(today.getFullYear(), today.getMonth(),today.getDate());
var today_end = new Date(today.getFullYear(), today.getMonth(),today.getDate()+1);
var dateRangeFilter = new tizen.AttributeRangeFilter("modifiedDate", today_begin, today_end);
function errorCB(err) {
console.log( 'The following error occurred: ' + err.name);
}
function findCB(contents) {
console.log('The contents modified today :' + contents.length);
}
tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
Constructors
AttributeRangeFilter(DOMString attributeName, optional any initialValue, optional any endValue);
Attributes
DOMString attributeName
The name of the object attribute used for filtering.
The value of this attribute is exactly as it is defined in the object's interface. For attributes of complex type, use fully-qualified names (such as 'geolocation.latitude' to filter a video or image content's latitude in a geolocation). For attributes of array type, the filter will match if any value in the array matches.
Since: 1.0
any initialValue
Objects with an attribute that is greater than or equal to initialValue will match.
By default, this attribute is set to null.
Since: 1.0
any endValue
Objects with an attribute that is strictly lower than or equal to endValue will match.
The composite filters can be one of the following 2 types:
The union - used to filter objects that match any of the filters it includes.
The intersection - used to filter objects that match all the filters it includes.
Code example:
// The following example retrieves all songs from the album "The Joshua Tree", by artist "U2".
var count = 100;
var offset = 0;
var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "U2");
var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
var filter = new tizen.CompositeFilter("INTERSECTION", [albumFilter, artistFilter]);
function errorCB(err) {
console.log( 'The following error occurred: ' + err.name);
}
function findCB(contents) {
console.log('The Joshua Tree by U2:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
Note that the sorting result of list type attributes is not determined.
Code example:
// The following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the track number.
var count = 100;
var offset = 0;
var sortMode = new tizen.SortMode("trackNumber", "ASC");
var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "U2");
var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
var filter = new tizen.CompositeFilter("INTERSECTION", [albumFilter, artistFilter]);
function errorCB(err) {
console.log( 'The following error occurred: ' + err.name);
}
function printContent(content, index, contents) {
console.log('Track: ' + content.trackNumber + ' Title: ' + content.title + 'Duration: ' + content.duration + 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
}
function findCB(contents) {
console.log('The Joshua Tree by U2:');
contents.forEach(printContent);
// Increase the offset as much as the count and then find content again.
if (contents.length == count) {
offset += count;
tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
}
}
tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
[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;
};
Since: 2.0
This interface will be used by the APIs to throw errors synchronously.
The attempt to set an attribute value may or may not raise WebAPIException synchronously with error type TypeMismatchError or InvalidValuesError.
Constants
INDEX_SIZE_ERR
The index is not in the allowed range.
Since: 2.0
DOMSTRING_SIZE_ERR
The specified range of text is too large.
Since: 2.0
HIERARCHY_REQUEST_ERR
The operation would yield an incorrect node tree.
Since: 2.0
WRONG_DOCUMENT_ERR
The object is in the wrong document.
Since: 2.0
INVALID_CHARACTER_ERR
The string contains invalid characters.
Since: 2.0
NO_DATA_ALLOWED_ERR
Data is specified for a node that does not support data.
Since: 2.0
NO_MODIFICATION_ALLOWED_ERR
The object cannot be modified.
Since: 2.0
NOT_FOUND_ERR
The object cannot be found here.
Since: 2.0
NOT_SUPPORTED_ERR
The operation is not supported.
Since: 2.0
INUSE_ATTRIBUTE_ERR
The specified attribute is already in use elsewhere.
Since: 2.0
INVALID_STATE_ERR
The object is in an invalid state.
Since: 2.0
SYNTAX_ERR
The string did not match the expected pattern.
Since: 2.0
INVALID_MODIFICATION_ERR
The object cannot be modified in this way.
Since: 2.0
NAMESPACE_ERR
The operation is not allowed by Namespaces in XML.
Since: 2.0
INVALID_ACCESS_ERR
The object does not support the operation or argument.
Since: 2.0
VALIDATION_ERR
The operation would cause the node to fail validation.
Since: 2.0
TYPE_MISMATCH_ERR
The type of the object does not match the expected type.
Since: 2.0
SECURITY_ERR
The operation is insecure.
Since: 2.0
NETWORK_ERR
A network error occurred.
Since: 2.0
ABORT_ERR
The operation has been aborted.
Since: 2.0
URL_MISMATCH_ERR
The given URL does not match another URL.
Since: 2.0
QUOTA_EXCEEDED_ERR
The quota has been exceeded.
Since: 2.0
TIMEOUT_ERR
The operation has timed out.
Since: 2.0
INVALID_NODE_TYPE_ERR
The supplied node is incorrect or has an incorrect ancestor for this operation.
Since: 2.0
DATA_CLONE_ERR
The object cannot be cloned.
Since: 2.0
Attributes
readonly unsigned short code
16-bit error code.
For the possible values of this attribute, see DOMException.
Since: 2.0
readonly DOMString name
An error type. The name attribute must return the value it had been initialized with.
This attribute can have one of the following values:
UnknownError - An unknown error has occurred.
InvalidValuesError - The content of an object does not contain valid values.
IOError - An error occurred in communication with the underlying implementation and so the requested method cannot be completed.
ServiceNotAvailableError - The requested service is not available.
VerificationError - An error occurred in authentication and so the requested method cannot be completed.
For other possible values of this attribute, see the values defined in DOM error names
Since: 2.0
readonly DOMString message
An error message that describes the details of an encountered error.
This attribute is mainly intended to be used for developers rather than end users, so it should not be used directly in the user interfaces as it is.
An error type. The name attribute must return the value it had been initialized with.
This attribute can have one of the following values:
UnknownError - An unknown error has occurred.
InvalidValuesError - The content of an object does not contain valid values.
IOError - An error occurred in communication with the underlying implementation and so the requested method cannot be completed.
ServiceNotAvailableError - The requested service is not available.
VerificationError - An error occurred in authentication and so the requested method cannot be completed.
For other possible values of this attribute, see the values defined in DOM error names
Since: 2.0
readonly DOMString message
An error message that describes the details of the error encountered.
This attribute is not intended to be used directly in the user interfaces as it is mainly intended to be useful for developers rather than end users.
Since: 2.0
2.11. SuccessCallback
This interface is used in methods that do not require any return value in the success callback.
If an invalid function (such as null) is passed to the API that accepts ErrorCallback, it silently fails and there is no further action.
Code example:
// Define the error callback.
function onerror(error) {
console.log(error.message);
}
function onsuccess() {
console.log("The application has launched successfully");
}
tizen.application.launch("targetApp0.main", onsuccess, onerror);
Methods
onerror
Method that is invoked when an error occurs.
void onerror(WebAPIError error);
Since: 1.0
Parameters:
error: Generic error.
3. Full WebIDL
module Tizen {
enum FilterMatchFlag { "EXACTLY", "FULLSTRING", "CONTAINS", "STARTSWITH", "ENDSWITH", "EXISTS" };
enum SortModeOrder { "ASC", "DESC" };
enum CompositeFilterType { "UNION", "INTERSECTION" };
[NoInterfaceObject] interface TizenObject {
readonly attribute Tizen tizen;
};
Window implements TizenObject;
[NoInterfaceObject] interface Tizen {
};
[NoInterfaceObject] interface AbstractFilter {
};
[Constructor(DOMString attributeName, optional FilterMatchFlag? matchFlag, optional any matchValue)]
interface AttributeFilter : AbstractFilter {
attribute DOMString attributeName;
attribute FilterMatchFlag matchFlag setraises(WebAPIException);
attribute any matchValue;
};
[Constructor(DOMString attributeName, optional any initialValue, optional any endValue)]
interface AttributeRangeFilter : AbstractFilter {
attribute DOMString attributeName;
attribute any initialValue;
attribute any endValue;
};
[Constructor(CompositeFilterType type, optional AbstractFilter[]? filters)]
interface CompositeFilter : AbstractFilter {
attribute CompositeFilterType type;
attribute AbstractFilter[] filters;
};
[Constructor(DOMString attributeName, optional SortModeOrder? order)]
interface SortMode {
attribute DOMString attributeName;
attribute SortModeOrder order setraises(WebAPIException);
};
[Constructor(double latitude, double longitude)]
interface SimpleCoordinates {
attribute double latitude setraises(WebAPIException);
attribute double longitude setraises(WebAPIException);
};
[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;
};
[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);
};
};
Manage Your Cookies
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.