</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- var key = 'nickname';
- var value = 'nickname of anonymous user';
- account.setExtendedData(key, value);
- console.log(account.getExtendedData(key)); // 'nickname of anonymous user'
-
- account.setExtendedData(key, 'nickname updated');
- console.log(account.getExtendedData(key)); // 'nickname updated'
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ var key = 'nickname';
+ var value = 'nickname of anonymous user';
+ account.setExtendedData(key, value);
+ console.log(account.getExtendedData(key)); /* 'Nickname of anonymous user' */
+
+ account.setExtendedData(key, 'nickname updated');
+ console.log(account.getExtendedData(key)); /* 'Nickname updated' */
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
<dt class="method" id="Account::getExtendedData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- var key = 'accessToken';
- var value = account.getExtendedData(key);
- console.log(account.userName + "'s accessToken is " + value);
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ var key = 'accessToken';
+ var value = account.getExtendedData(key);
+ console.log(account.userName + "'s accessToken is " + value);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
<dt class="method" id="Account::getExtendedData-2">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- account.getExtendedData(function(extendedData) {
- for(var i=0; i < extendedData.length; i++) {
- var key = extendedData.key;
- var value = extendedData.value;
- console.log(key + " : " + value);
- }
- }, function(e) {
- console.log("Error : " + e.message);
- });
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ account.getExtendedData(function(extendedData)
+ {
+ for (var i = 0; i < extendedData.length; i++)
+ {
+ var key = extendedData.key;
+ var value = extendedData.value;
+ console.log(key + ": " + value);
+ }
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- var provider = tizen.account.getProvider(appId);
- var account = new tizen.Account(provider, {userName: 'admin', iconUri: 'path/to/icon.jpg'});
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+var provider = tizen.account.getProvider(appId);
+var account = new tizen.Account(provider, {userName: 'admin', iconUri: 'path/to/icon.jpg'});
- tizen.account.add(account);
- </pre>
+tizen.account.add(account);
+</pre>
</div>
</dd>
<dt class="method" id="AccountManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- tizen.account.remove(account.id);
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ tizen.account.remove(account.id);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
<dt class="method" id="AccountManager::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- account.userName = 'abc';
- tizen.account.update(account);
- })
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ account.userName = 'abc';
+ tizen.account.update(account);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
<dt class="method" id="AccountManager::getAccount">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var account = tizen.account.getAccount(1);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var account = tizen.account.getAccount(1);
+</pre>
</div>
</dd>
<dt class="method" id="AccountManager::getAccounts">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.account.getAccounts(function(accounts) {
- // accounts is an array whose members are all registered accounts in this device.
- }, function (e) {
- console.log("Error : " + e.message);
- });
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.account.getAccounts(function(accounts)
+{
+ /* accounts is an array whose members are all registered accounts in this device */
+}, function(e)
+{
+ console.log("Error: " + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="AccountManager::getProvider">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- var provider = tizen.account.getProvider(appId);
- if (!provider) {
- console.log('current application is not account provider.');
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+var provider = tizen.account.getProvider(appId);
+if (!provider)
+{
+ console.log('current application is not account provider.');
+}
+</pre>
</div>
</dd>
<dt class="method" id="AccountManager::getProviders">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.account.getProviders(function(providers) {
- // providers is an array whose members are account providers
- // which have contact capability.
- }, function (e) {
- console.log('Error : ' + e.message);
- }, "http://tizen.org/account/capability/contact");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.account.getProviders(function(providers)
+{
+ /*
+ providers is an array whose members are account providers
+ which have contact capability
+ */
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, "http://tizen.org/account/capability/contact");
+</pre>
</div>
</dd>
<dt class="method" id="AccountManager::addAccountListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.account.addAccountListener({
- onadded: function(account) {
- // a callback function which will be called when account is added.
- },
- onremoved: function(accountId) {
- // a callback function which will be called when account is removed.
- },
- onupdated: function(account) {
- // a callback function which will be called when account is updated.
- }
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.account.addAccountListener(
+{
+ onadded: function(account)
+ {
+ /* Callback function which will be called when account is added */
+ },
+ onremoved: function(accountId)
+ {
+ /* Callback function which will be called when account is removed */
+ },
+ onupdated: function(account)
+ {
+ /* Callback function which will be called when account is updated */
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="AccountManager::removeAccountListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watchId = tizen.account.addAccountListener({
- onadded: function(account) {
- // a callback function which will be called when account is added.
- },
- onremoved: function(accountId) {
- // a callback function which will be called when account is removed.
- },
- onupdated: function(account) {
- // a callback function which will be called when account is updated.
- }
- });
- tizen.account.removeAccountListener(watchId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watchId = tizen.account.addAccountListener(
+{
+ onadded: function(account)
+ {
+ /* Callback function which will be called when account is added */
+ },
+ onremoved: function(accountId)
+ {
+ /* Callback function which will be called when account is removed */
+ },
+ onupdated: function(account)
+ {
+ /* Callback function which will be called when account is updated */
+ }
+});
+tizen.account.removeAccountListener(watchId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Triggers an alarm on a given date/time
- var alarm = new tizen.AlarmAbsolute(new Date(2014, 10, 4, 8, 0));
- var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
- tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
- console.log("Alarm added with id: " + alarm.id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Triggers an alarm on a given date/time */
+var alarm = new tizen.AlarmAbsolute(new Date(2014, 10, 4, 8, 0));
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
+tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
+console.log("Alarm added with id: " + alarm.id);
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alarms = tizen.alarm.getAll();
-
- // Removes the first alarm
- if (alarms.length > 0) {
- try {
- tizen.alarm.remove(alarms[0].id);
- console.log("Successfully removed the first alarm.");
- } catch(error) {
- console.log("Failed to remove the first alarm.");
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alarms = tizen.alarm.getAll();
+
+/* Removes the first alarm */
+if (alarms.length > 0)
+{
+ try
+ {
+ tizen.alarm.remove(alarms[0].id);
+ console.log("Successfully removed the first alarm.");
+ }
+ catch (error)
+ {
+ console.log("Failed to remove the first alarm.");
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::removeAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.alarm.removeAll();
- console.log("remove all registered alarms in the storage.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.alarm.removeAll();
+console.log("remove all registered alarms in the storage.");
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sets an alarm
- var date = new Date();
- date.setHours(date.getHours()+1);
- var abs_alarm = new tizen.AlarmAbsolute(date);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sets an alarm */
+var date = new Date();
+date.setHours(date.getHours() + 1);
+var abs_alarm = new tizen.AlarmAbsolute(date);
- // Adds an alarm
- tizen.alarm.add(abs_alarm, tizen.application.getCurrentApplication().appInfo.id);
+/* Adds an alarm */
+tizen.alarm.add(abs_alarm, tizen.application.getCurrentApplication().appInfo.id);
- // Gets an alarm
- var alarm = tizen.alarm.get(abs_alarm.id);
- console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
- </pre>
+/* Gets an alarm */
+var alarm = tizen.alarm.get(abs_alarm.id);
+console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::getAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alarms = tizen.alarm.getAll();
- console.log(alarms.length + " alarms present in the storage.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alarms = tizen.alarm.getAll();
+console.log(alarms.length + " alarms present in the storage.");
+</pre>
</div>
</dd>
</dl>
If <em>period</em> is provided, it will be adjusted by the operating system, however this value will not be lower than 600 seconds.
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm in 3 hours from now
- var alarm1 = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
- tizen.alarm.add(alarm1, appId);
+/* Sets an alarm in 3 hours from now */
+var alarm1 = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
+tizen.alarm.add(alarm1, appId);
- // Sets an alarm in one hour, recurring after every 10 minutes
- var alarm2 = new tizen.AlarmRelative(tizen.alarm.PERIOD_HOUR, 10 * tizen.alarm.PERIOD_MINUTE);
- tizen.alarm.add(alarm2, appId);
- </pre>
+/* Sets an alarm in one hour, recurring after every 10 minutes */
+var alarm2 = new tizen.AlarmRelative(tizen.alarm.PERIOD_HOUR, 10 * tizen.alarm.PERIOD_MINUTE);
+tizen.alarm.add(alarm2, appId);
+</pre>
</div>
<div class="constructors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm in 3 hours from now
- var alarm = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
- tizen.alarm.add(alarm, appId);
+/* Sets an alarm in 3 hours from now */
+var alarm = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
+tizen.alarm.add(alarm, appId);
- var sec = alarm.getRemainingSeconds();
- console.log("remaining time is " + sec);
- </pre>
+var sec = alarm.getRemainingSeconds();
+console.log("remaining time is " + sec);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm on January 1st 2014 08:00
- var date = new Date(2014, 0, 1, 8, 0);
- var alarm1 = new tizen.AlarmAbsolute(date);
- tizen.alarm.add(alarm1, appId);
+/* Sets an alarm on January 1st 2014 08:00 */
+var date = new Date(2014, 0, 1, 8, 0);
+var alarm1 = new tizen.AlarmAbsolute(date);
+tizen.alarm.add(alarm1, appId);
- // Sets an alarm on January 1st 2014 08:00, repeating every 2 days
- var alarm2 = new tizen.AlarmAbsolute(date, 2 * tizen.alarm.PERIOD_DAY);
- tizen.alarm.add(alarm2, appId);
+/* Sets an alarm on January 1st 2014 08:00, repeating every 2 days */
+var alarm2 = new tizen.AlarmAbsolute(date, 2 * tizen.alarm.PERIOD_DAY);
+tizen.alarm.add(alarm2, appId);
- // Sets an alarm occurring on every Saturday and Sunday, at 08:00, starting from January 1st 2014
- var alarm3 = new tizen.AlarmAbsolute(date, ["SA", "SU"]);
- tizen.alarm.add(alarm3, appId);
- </pre>
+/* Sets an alarm occurring on every Saturday and Sunday, at 08:00, starting from January 1st 2014 */
+var alarm3 = new tizen.AlarmAbsolute(date, ["SA", "SU"]);
+tizen.alarm.add(alarm3, appId);
+</pre>
</div>
<div class="constructors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
-
- // Sets an alarm on January 1st 2014 08:00
- var date = new Date(2014, 0, 1, 8, 0);
- var alarm1 = new tizen.AlarmAbsolute(date);
- tizen.alarm.add(alarm1, appId);
-
- var date = alarm1.getNextScheduledDate();
- console.log("next scheduled time is " + date);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+
+/* Sets an alarm on January 1st 2014 08:00 */
+var date = new Date(2014, 0, 1, 8, 0);
+var alarm1 = new tizen.AlarmAbsolute(date);
+tizen.alarm.add(alarm1, appId);
+
+var date = alarm1.getNextScheduledDate();
+console.log("next scheduled time is " + date);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
- console.log("Current application's app id is " + app.appInfo.id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+console.log("Current application's app id is " + app.appInfo.id);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::kill">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onKillSuccess() {
- console.log("Application terminated successfully");
- }
-
- function onRunningAppsContext(contexts) {
- // let's assume that the application "targetApp0.main" has been installed.
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++) {
- if (contexts[i].appId == targetId) {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
- }
-
- tizen.application.getAppsContext(onRunningAppsContext);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onKillSuccess()
+{
+ console.log("Application terminated successfully");
+}
+
+function onRunningAppsContext(contexts)
+{
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
+}
+
+tizen.application.getAppsContext(onRunningAppsContext);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::launch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess() {
- console.log("The application has launched successfully");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess()
+{
+ console.log("The application has launched successfully");
+}
- // let's assume that application "targetApp0.main" has been installed
- tizen.application.launch("targetApp0.main", onsuccess);
- </pre>
+/* Let's assume that application "targetApp0.main" has been installed */
+tizen.application.launch("targetApp0.main", onsuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::launchAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- tizen.application.launchAppControl(
- appControl,
- null,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+var appControlReplyCallback =
+{
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+}
+
+tizen.application.launchAppControl(appControl, null,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::findAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- function successCB(appInfos, appControl)
- {
- // appControl is same object with the value passed as first parameter to findAppControl()
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; // select first app's id
-
- tizen.application.launchAppControl(
- appControl,
- appId,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- }
-
- tizen.application.findAppControl(appControl, successCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+function successCB(appInfos, appControl)
+{
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+}
+
+tizen.application.findAppControl(appControl, successCB);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppsContext">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onRunningAppsContext(contexts) {
- for (var i = 0; i < contexts.length; i++)
- console.log("ID : " + contexts[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onRunningAppsContext(contexts)
+{
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
+}
- tizen.application.getAppsContext(onRunningAppsContext);
- </pre>
+tizen.application.getAppsContext(onRunningAppsContext);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppContext">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appContext = tizen.application.getAppContext(null);
- console.log("Application context retrieved for app " + appContext.appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appContext = tizen.application.getAppContext(null);
+console.log("Application context retrieved for app " + appContext.appId);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppsInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledApps(applications) {
- for (var i = 0; i < applications.length; i++)
- console.log("ID : " + applications[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledApps(applications)
+{
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
+}
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appInfo = tizen.application.getAppInfo(null);
- console.log("Current application name : " + appInfo.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appInfo = tizen.application.getAppInfo(null);
+console.log("Current application name: " + appInfo.name);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppCerts">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appCerts = tizen.application.getAppCerts(null);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appCerts = tizen.application.getAppCerts(null);
- for (var i = 0; i < appCerts.length; i++) {
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
- }
- </pre>
+for (var i = 0; i < appCerts.length; i++)
+{
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppSharedURI">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var sharedDir = tizen.application.getAppSharedURI(null);
- console.log("shared directory : " + sharedDir);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var sharedDir = tizen.application.getAppSharedURI(null);
+console.log("shared directory: " + sharedDir);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppMetaData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var metaDataArray = tizen.application.getAppMetaData(null);
- console.log("size of metadata : " + metaDataArray.length);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var metaDataArray = tizen.application.getAppMetaData(null);
+console.log("size of metadata: " + metaDataArray.length);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ApplicationManager::addAppInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ApplicationManager::removeAppInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- tizen.application.removeAppInfoEventListener(watchId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+tizen.application.removeAppInfoEventListener(watchId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
- app.exit();
- </pre>
+app.exit();
+</pre>
</div>
</dd>
<dt class="method" id="Application::hide">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
- app.hide();
- </pre>
+app.hide();
+</pre>
</div>
</dd>
<dt class="method" id="Application::getRequestedAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
- }
- </pre>
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Application::addEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- if (appId) {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data) {
- console.log("Data: " + JSON.stringify(data));
- // do something
- });
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="Application::removeEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- if (appId) {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data) {
- if (watchId) {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="Application::broadcastEvent">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCustomData = {
- foo: 'bar'
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCustomData =
+{
+ foo: 'bar'
+};
- var app = tizen.application.getCurrentApplication();
+var app = tizen.application.getCurrentApplication();
- app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
- </pre>
+app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
+</pre>
</div>
</dd>
<dt class="method" id="Application::broadcastTrustedEvent">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myTrustedCustomData = {
- foo: 'bar'
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myTrustedCustomData =
+{
+ foo: 'bar'
+};
- var app = tizen.application.getCurrentApplication();
+var app = tizen.application.getCurrentApplication();
- app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
- </pre>
+app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
+</pre>
</div>
</dd>
</dl>
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
+</pre>
</div>
<div class="constructors">
<h4 id="ApplicationControlData::constructor">Constructors</h4>
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl =
- new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/view",
- null,
- "image/jpeg",
- null,
- [new tizen.ApplicationControlData("images",
- [imagedata1, imagedata2])] );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+</pre>
</div>
<div class="constructors">
<h4 id="ApplicationControl::constructor">Constructors</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick") {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="RequestedApplicationControl::replyFailure">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick") {
- reqAppControl.replyFailure();
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledApps(applications) {
- for (var i = 0; i < applications.length; i++)
- console.log("ID : " + applications[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledApps(applications)
+{
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
+}
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- // FindAppControlSuccessCallback instance
- function successCB(appInfos, appControl)
- {
- // appControl is same object with the value passed as first parameter to findAppControl()
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; // select first app's id
-
- tizen.application.launchAppControl(
- appControl,
- appId,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- }
-
- tizen.application.findAppControl(appControl, successCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+/* FindAppControlSuccessCallback instance */
+function successCB(appInfos, appControl)
+{
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+}
+
+tizen.application.findAppControl(appControl, successCB);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- // ApplicationControlDataArrayReplyCallback instance
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- tizen.application.launchAppControl(
- appControl,
- null,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+/* ApplicationControlDataArrayReplyCallback instance */
+var appControlReplyCallback =
+{
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+}
+
+tizen.application.launchAppControl(appControl, null,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data) {
- console.log("Data: " + JSON.stringify(data));
- // do something
- };
-
- if (appId) {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCallback(archive) {
- console.log("Success, can now read from archive " + archive);
- }
-
- function errorCallback(error) {
- console.log(error);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCallback(archive)
+{
+ console.log("Success, can now read from archive " + archive);
+}
+
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveManager::abort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function openSuccess(archive) {
- operationId = archive.extractAll("downloads/extracted");
- tizen.archive.abort(operationId);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function openSuccess(archive)
+{
+ operationId = archive.extractAll("downloads/extracted");
+ tizen.archive.abort(operationId);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function successCallback() {
- console.log("done");
- }
-
- function progressCallback(opId, val, name) {
- console.log("opId: " + opId + " with progress val: " + val);
- }
-
- function createSuccess(archive) {
- archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
- }
-
- tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function successCallback()
+{
+ console.log("done");
+}
+
+function progressCallback(opId, val, name)
+{
+ console.log("opId: " + opId + " with progress val: " + val);
+}
+
+function createSuccess(archive)
+{
+ archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
+}
+
+tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::extractAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function successCallback() {
- console.log("done");
- }
-
- function progressCallback(opId, val, name) {
- console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
- }
-
- function openSuccess(archive) {
- archive.extractAll("music", successCallback, errorCallback, progressCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function successCallback()
+{
+ console.log("done");
+}
+
+function progressCallback(opId, val, name)
+{
+ console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
+}
+
+function openSuccess(archive)
+{
+ archive.extractAll("music", successCallback, errorCallback, progressCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::getEntries">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function getEntriesSuccess(entries) {
- console.log("Entries length: " + entries.length);
- for (var i=0; i < entries.length; i++) {
- console.log(entries[i].name);
- }
- }
-
- function openSuccess(archive) {
- archive.getEntries(getEntriesSuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function getEntriesSuccess(entries)
+{
+ console.log("Entries length: " + entries.length);
+ for (var i = 0; i < entries.length; i++)
+ {
+ console.log(entries[i].name);
+ }
+}
+
+function openSuccess(archive)
+{
+ archive.getEntries(getEntriesSuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::getEntryByName">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function getEntrySuccess(entry) {
- console.log("Entry: " + entry.name + " size: " + entry.size);
- }
-
- function openSuccess(archive) {
- archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function getEntrySuccess(entry)
+{
+ console.log("Entry: " + entry.name + " size: " + entry.size);
+}
+
+function openSuccess(archive)
+{
+ archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::close">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function extractSuccessCallback() {
- console.log("done");
- }
-
- function getEntrySuccess(entry) {
- entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
- }
-
- function openSuccess(archive) {
- archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function extractSuccessCallback()
+{
+ console.log("done");
+}
+
+function getEntrySuccess(entry)
+{
+ entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
+}
+
+function openSuccess(archive)
+{
+ archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
+</pre>
</div>
</dd>
</dl>
2.3
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Maximum length of a badge number is " + tizen.badge.maxBadgeCount);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log("Maximum length of a badge number is " + tizen.badge.maxBadgeCount);
+</pre>
</div>
</li></ul>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
- var appid = app.appInfo.id;
- tizen.badge.setBadgeCount(appid, 3);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+var appid = app.appInfo.id;
+tizen.badge.setBadgeCount(appid, 3);
+</pre>
</div>
</dd>
<dt class="method" id="BadgeManager::getBadgeCount">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
- var appid = app.appInfo.id;
- var count = tizen.badge.getBadgeCount(appid);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+var appid = app.appInfo.id;
+var count = tizen.badge.getBadgeCount(appid);
+</pre>
</div>
</dd>
<dt class="method" id="BadgeManager::addChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Let's assume that at least two applications are installed
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assume that at least two applications are installed */
- function onListInstalledApps(appsInfo) {
- function watcher(appId, count) {
- console.log(appId + ' badge number were updated : ' + count);
- }
+function onListInstalledApps(appsInfo)
+{
+ function watcher(appId, count)
+ {
+ console.log(appId + ' badge number were updated: ' + count);
+ }
- // Registers to be notified when the badge number changes
- tizen.badge.addChangeListener([appsInfo[0].id, [appsInfo[1].id], watcher);
- }
+ /* Registers to be notified when the badge number changes */
+ tizen.badge.addChangeListener([appsInfo[0].id, [appsInfo[1].id], watcher);
+}
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="BadgeManager::removeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Let's assume that at least two applications are installed
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assume that at least two applications are installed */
- function onListInstalledApps(appsInfo) {
- function watcher(appId, count) {
- console.log(appId + ' badge number were updated : ' + count);
- }
+function onListInstalledApps(appsInfo)
+{
+ function watcher(appId, count)
+ {
+ console.log(appId + ' badge number were updated: ' + count);
+ }
- // Registers to be notified when the badge number changes
- tizen.badge.addChangeListener([appsInfo[0].id, [appsInfo[1].id], watcher);
+ /* Registers to be notified when the badge number changes */
+ tizen.badge.addChangeListener([appsInfo[0].id, [appsInfo[1].id], watcher);
- // Cancels the watch operation
- tizen.badge.removeChangeListener([appsInfo[0].id, [appsInfo[1].id]);
- }
+ /* Cancels the watch operation */
+ tizen.badge.removeChangeListener([appsInfo[0].id, [appsInfo[1].id]);
+}
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // logs the number of badge changes:
- function watcher(appId, count) {
- console.log(appId + ' -> badge number updates: ' + count);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Logs the number of badge changes */
+function watcher(appId, count)
+{
+ console.log(appId + ' -> badge number updates: ' + count);
+}
- // gets Application's ID:
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+/* Gets Application's ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // let's assume that the application "TestSample.main" has been installed.
- var targetAppId = "TestSample.main";
+/* Assume that the application "TestSample.main" has been installed */
+var targetAppId = "TestSample.main";
- // registers to be notified when the badge number changes for either
- // this or targetAppId application:
- tizen.badge.addChangeListener([appId, targetAppId], watcher);
- </pre>
+/*
+ Registers to be notified when the badge number changes for either
+ this or targetAppId application
+*/
+tizen.badge.addChangeListener([appId, targetAppId], watcher);
+</pre>
</div>
</dd>
</dl>
<dl>
<pre class="webidl prettyprint">BluetoothLEServiceData(DOMString uuid, DOMString data);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a serviceData.
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a serviceData */
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+</pre>
+</div>
+</dl>
</div>
<div class="attributes">
<h4>Attributes</h4>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a serviceData.
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- service.uuid = "f236-41a4";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a serviceData */
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+service.uuid = "f236-41a4";
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEServiceData::data">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a serviceData.
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- service.data = "0x1815";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a serviceData */
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+service.data = "0x1815";
+</pre>
</div>
</li>
</ul>
<dl>
<pre class="webidl prettyprint">BluetoothLEManufacturerData(DOMString id, DOMString data);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a manufacturerData.
- var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a manufacturerData */
+var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
+</pre>
</div>
</dl>
</div>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a manufacturerData.
- var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
- manufacturer.id = "129";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a manufacturerData */
+var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
+manufacturer.id = "129";
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEManufacturerData::data">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a manufacturerData.
- var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
- manufacturer.data = "0x0059"
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a manufacturerData */
+var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
+manufacturer.data = "0x0059"
+</pre>
</div>
</li>
</ul>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
- appearance: 192, includeTxPowerLevel: false }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertData =
+{
+ includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
+ appearance: 192, includeTxPowerLevel: false
+}
+</pre>
</div>
</div>
<div class="interface" id="BluetoothLEAdvertiseData">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
- appearance: 192, includeTxPowerLevel: false }
- var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertData =
+{
+ includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
+ appearance: 192, includeTxPowerLevel: false
+}
+var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
+</pre>
</div>
<div class="constructors">
<h4 id="BluetoothLEAdvertiseData::constructor">Constructors</h4>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.includeName = true;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.includeName = true;
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::uuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.uuids = ["180d"];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.uuids = ["180d"];
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::solicitationuuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.solicitationuuids = ["180f"];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.solicitationuuids = ["180f"];
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::appearance">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.appearance = 192;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.appearance = 192;
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::includeTxPowerLevel">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.includeTxPowerLevel = true;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.includeTxPowerLevel = true;
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::serviceData">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- advertise.serviceData = service;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+advertise.serviceData = service;
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::manufacturerData">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
- advertise.manufacturerData = manufacture;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
+advertise.manufacturerData = manufacture;
+</pre>
</div>
</li>
</ul>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(tizen.bluetooth.deviceMajor);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(tizen.bluetooth.deviceMajor);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothManager::deviceMinor">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(tizen.bluetooth.deviceMinor);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(tizen.bluetooth.deviceMinor);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothManager::deviceService">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(tizen.bluetooth.deviceService);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(tizen.bluetooth.deviceService);
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter = tizen.bluetooth.getDefaultAdapter() ;
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter = tizen.bluetooth.getDefaultAdapter();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothManager::getLEAdapter">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter = tizen.bluetooth.getLEAdapter();
- } catch (err) {
- console.log(err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter = tizen.bluetooth.getLEAdapter();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Access adapter name
- var adapter = tizen.bluetooth.getDefaultAdapter();
- console.log ("Bluetooth adapter name: " + adapter.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Access adapter name */
+var adapter = tizen.bluetooth.getDefaultAdapter();
+console.log("Bluetooth adapter name: " + adapter.name);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothAdapter::address">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- console.log("Bluetooth device address: " + adapter.address);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+console.log("Bluetooth device address: " + adapter.address);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothAdapter::powered">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothAdapter::visible">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Queries the current visible state
- var adapter = tizen.bluetooth.getDefaultAdapter();
- console.log ("Bluetooth Visibility: " + (adapter.visible ? "On" : "Off"));
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Queries the current visible state */
+var adapter = tizen.bluetooth.getDefaultAdapter();
+console.log("Bluetooth Visibility: " + (adapter.visible ? "On" : "Off"));
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
-
- function changeName(newName) {
- if (adapter.name != newName) {
- // initiate change name
- adapter.setName(newName, function() {
- console.log("Adapter name changed to " + adapter.name);
- },
- function(e) {
- console.log("Failed to change name: " + e.message);
- });
- }
- }
- if (bt_always_on === false) {
- changeName("myDevice");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
+
+function changeName(newName)
+{
+ if (adapter.name != newName)
+ {
+ /* Initiate change name */
+ adapter.setName(newName, function()
+ {
+ console.log("Adapter name changed to " + adapter.name);
+ }, function(e)
+ {
+ console.log("Failed to change name: " + e.message);
+ });
+ }
+}
+if (bt_always_on === false)
+{
+ changeName("myDevice");
+}
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::setPowered">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function powerOn() {
- // If adapter is not powered on
- if (!adapter.powered) {
- // Initiates power on
- adapter.setPowered(true, function() {
- console.log("Bluetooth powered on success.");
- },
- function(e) {
- console.log("Failed to power on Bluetooth: " + e.message);
- });
- }
- }
-
- function powerOff() {
- // If powered on
- if (adapter.powered) {
- // Initiates power off
- adapter.setPowered(false, function() {
- console.log("Bluetooth powered off successfully.");
- },
- function(e) {
- console.log("Failed to power off Bluetooth: " + e.message);
- });
- }
- }
-
- var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
- if (bt_always_on === true) {
- console.log("Bluetooth cannot be turn off or on because this device must be always enabled.");
- } else {
- powerOn();
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function powerOn()
+{
+ /* If adapter is not powered on */
+ if (!adapter.powered)
+ {
+ /* Initiates power on */
+ adapter.setPowered(true, function()
+ {
+ console.log("Bluetooth powered on success.");
+ }, function(e)
+ {
+ console.log("Failed to power on Bluetooth: " + e.message);
+ });
+ }
+}
+
+function powerOff()
+{
+ /* If powered on */
+ if (adapter.powered)
+ {
+ /* Initiates power off */
+ adapter.setPowered(false, function()
+ {
+ console.log("Bluetooth powered off successfully.");
+ }, function(e)
+ {
+ console.log("Failed to power off Bluetooth: " + e.message);
+ });
+ }
+}
+
+var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
+if (bt_always_on === true)
+{
+ console.log("Bluetooth cannot be turn off or on because this device must be always enabled.");
+}
+else
+{
+ powerOn();
+}
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::setChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changeListener = {
- onstatechanged: function(powered) {
- console.log ("Power state is changed into: " + powered);
- },
- onnamechanged: function(name) {
- console.log("Name is changed to: " + name);
- },
- onvisibilitychanged: function(visible) {
- console.log("Visibility is changed into: " + visible);
- }
- };
-
- var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setChangeListener(changeListener);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changeListener =
+{
+ onstatechanged: function(powered)
+ {
+ console.log("Power state is changed into: " + powered);
+ },
+ onnamechanged: function(name)
+ {
+ console.log("Name is changed to: " + name);
+ },
+ onvisibilitychanged: function(visible)
+ {
+ console.log("Visibility is changed into: " + visible);
+ }
+};
+
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.setChangeListener(changeListener);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::unsetChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- var changeListener = {
- onstatechanged: function(powered) {
- console.log ("Power state is changed into: " + powered);
- if (!powered)
- adapter.unsetChangeListener();
- },
- onnamechanged: function(name) {
- console.log("Name is changed to: " + name);
- },
- onvisibilitychanged: function(visible) {
- console.log("Visibility is changed into: " + visible);
- }
- };
-
- adapter.setChangeListener(changeListener);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+var changeListener =
+{
+ onstatechanged: function(powered)
+ {
+ console.log("Power state is changed into: " + powered);
+ if (!powered)
+ adapter.unsetChangeListener();
+ },
+ onnamechanged: function(name)
+ {
+ console.log("Name is changed to: " + name);
+ },
+ onvisibilitychanged: function(visible)
+ {
+ console.log("Visibility is changed into: " + visible);
+ }
+};
+
+adapter.setChangeListener(changeListener);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::discoverDevices">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function startDiscovery() {
-
- var discoverDevicesSuccessCallback = {
- onstarted: function() {
- console.log ("Device discovery started...");
- },
- ondevicefound: function(device) {
- console.log("Found device - name: " + device.name + ", Address: "+ device.address);
- },
- ondevicedisappeared: function(address) {
- console.log("Device disappeared: " + address);
- },
- onfinished: function(devices) {
- console.log("Found Devices");
- for (var i = 0; i < devices.length; i++) {
- console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
- };
-
- // Starts searching for nearby devices, for about 12 sec.
- adapter.discoverDevices(discoverDevicesSuccessCallback, function(e) {
- console.log ("Failed to search devices: " + e.message + "(" + e.name + ")");
- });
- }
-
- function onSetPoweredError(e) {
- console.log ("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
- }
-
- adapter.setPowered(true, startDiscovery, onSetPoweredError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function startDiscovery()
+{
+ var discoverDevicesSuccessCallback =
+ {
+ onstarted: function()
+ {
+ console.log("Device discovery started...");
+ },
+ ondevicefound: function(device)
+ {
+ console.log("Found device - name: " + device.name + ", Address: " + device.address);
+ },
+ ondevicedisappeared: function(address)
+ {
+ console.log("Device disappeared: " + address);
+ },
+ onfinished: function(devices)
+ {
+ console.log("Found Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+ }
+ };
+
+ /* Starts searching for nearby devices, for about 12 sec */
+ adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
+ {
+ console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
+ });
+}
+
+function onSetPoweredError(e)
+{
+ console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
+}
+
+adapter.setPowered(true, startDiscovery, onSetPoweredError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::stopDiscovery">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- // Calls this method whenever user finds one of the device.
- function cancelDiscovery() {
- adapter.stopDiscovery(function() {
- console.log("Stop discovery success.");
- },
- function (e) {
- console.log("Error while stopDiscovery:" + e.message);
- });
- }
-
- function startDiscovery() {
-
- var discoverDevicesSuccessCallback = {
- onstarted: function() {
- console.log ("Device discovery started...") ;
- },
- ondevicefound: function(device) {
- console.log("Found device - name: " + device.name + ", Address: "+ device.address);
- // Shows the device to user to check if this is the device user is looking for.
- // For example, add this to list view.
-
- cancelDiscovery();
- },
- ondevicedisappeared: function(address) {
- console.log("Device disappeared: " + address);
- // Removes from list, as it is no longer valid.
- },
- onfinished: function(devices) {
- console.log("Found Devices");
- for (var i = 0; i < devices.length; i++) {
- console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
- };
-
- // Starts searching for nearby devices, for about 12 sec.
- adapter.discoverDevices(discoverDevicesSuccessCallback, function(e) {
- console.log ("Failed to search devices: " + e.message + "(" + e.name + ")");
- });
- }
-
- function onSetPoweredError(e) {
- console.log ("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
- }
-
- adapter.setPowered(true, startDiscovery, onSetPoweredError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+/* Calls this method whenever user finds one of the device */
+function cancelDiscovery()
+{
+ adapter.stopDiscovery(function()
+ {
+ console.log("Stop discovery success.");
+ }, function(e)
+ {
+ console.log("Error while stopDiscovery:" + e.message);
+ });
+}
+
+function startDiscovery()
+{
+ var discoverDevicesSuccessCallback =
+ {
+ onstarted: function()
+ {
+ console.log("Device discovery started...");
+ },
+ ondevicefound: function(device)
+ {
+ console.log("Found device - name: " + device.name + ", Address: " + device.address);
+ /* Shows the device to user to check if this is the device user is looking for */
+ /* For example, add this to list view */
+
+ cancelDiscovery();
+ },
+ ondevicedisappeared: function(address)
+ {
+ console.log("Device disappeared: " + address);
+ /* Removes from list, as it is no longer valid */
+ },
+ onfinished: function(devices)
+ {
+ console.log("Found Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+ }
+ };
+
+ /* Starts searching for nearby devices, for about 12 sec */
+ adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
+ {
+ console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
+ });
+}
+
+function onSetPoweredError(e)
+{
+ console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
+}
+
+adapter.setPowered(true, startDiscovery, onSetPoweredError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::getKnownDevices">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function onGotDevices(devices) {
- console.log("Devices");
- for (var i = 0; i < devices.length; i++) {
- console.log(" Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
-
- function onError(e) {
- console.log ("Error: " + e.message);
- }
-
- function onBluetoothsetPowered() {
- adapter.getKnownDevices(onGotDevices, onError);
- }
-
- // Turns on Bluetooth
- adapter.setPowered(true, onBluetoothsetPowered);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function onGotDevices(devices)
+{
+ console.log("Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log(" Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+}
+
+function onError(e)
+{
+ console.log("Error: " + e.message);
+}
+
+function onBluetoothsetPowered()
+{
+ adapter.getKnownDevices(onGotDevices, onError);
+}
+
+/* Turns on Bluetooth */
+adapter.setPowered(true, onBluetoothsetPowered);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::getDevice">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function gotDeviceInfo(device) {
- console.log("Device Name: " + device.name);
- console.log("Device Address: " + device.address);
- console.log("Device Class: " + device.deviceClass.major);
- console.log("Is Bonded: " + (device.isBonded ? "Yes" : "No"));
- }
-
- function onError(e) {
- console.log ("Could not get device info:" + e.message);
- }
-
- var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo, onError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function gotDeviceInfo(device)
+{
+ console.log("Device Name: " + device.name);
+ console.log("Device Address: " + device.address);
+ console.log("Device Class: " + device.deviceClass.major);
+ console.log("Is Bonded: " + (device.isBonded ? "Yes" : "No"));
+}
+
+function onError(e)
+{
+ console.log("Could not get device info:" + e.message);
+}
+
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo, onError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::createBonding">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onBondingSuccess(device) {
- console.log("Device Name:" + device.name);
- console.log("Device Address:" + device.address);
- console.log("Device Service UUIDs:" + device.uuids.join("\n"));
- }
-
- function onError(e) {
- console.log ("Could not create bonding, reason:" + e.message);
- }
-
- var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.createBonding("35:F4:59:D1:7A:03", onBondingSuccess, onError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onBondingSuccess(device)
+{
+ console.log("Device Name:" + device.name);
+ console.log("Device Address:" + device.address);
+ console.log("Device Service UUIDs:" + device.uuids.join("\n"));
+}
+
+function onError(e)
+{
+ console.log("Could not create bonding, reason:" + e.message);
+}
+
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.createBonding("35:F4:59:D1:7A:03", onBondingSuccess, onError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::destroyBonding">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function gotDevice(device) {
- if (device.isBonded) {
- // Initiates destroying bonding
- adapter.destroyBonding(device.address, function() {
- console.log("Succeeded to destroy the bond success with:" + device.address);
- },
- function(e) {
- console.log("Failed to destroy the bond with " + device.address + ", reason: " + e.message);
- });
- }
- }
-
- var deviceAddress = "35:F4:59:D1:7A:03";
- adapter.getDevice(deviceAddress, gotDevice, function(e) {
- console.log("Failed to get device info for " + deviceAddress + ", reason: " + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function gotDevice(device)
+{
+ if (device.isBonded)
+ {
+ /* Initiates destroying bonding */
+ adapter.destroyBonding(device.address, function()
+ {
+ console.log("Succeeded to destroy the bond success with:" + device.address);
+ }, function(e)
+ {
+ console.log("Failed to destroy the bond with " + device.address + ", reason: " + e.message);
+ });
+ }
+}
+
+var deviceAddress = "35:F4:59:D1:7A:03";
+adapter.getDevice(deviceAddress, gotDevice, function(e)
+{
+ console.log("Failed to get device info for " + deviceAddress + ", reason: " + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::registerRFCOMMServiceByUUID">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- // Holds currently registered service record
- var chatServiceHandler = null;
- // Holds currently open socket
- var serviceSocket = null;
-
- function chatServiceSuccessCb(recordHandler) {
- console.log("Chat service registration succeeds!");
- chatServiceHandler = recordHandler;
- recordHandler.onconnect = function(socket) {
- console.log("Client connected: " + socket.peer.name + "," + socket.peer.address);
- serviceSocket = socket;
- // Messages received from remote device
- socket.onmessage = function() {
- var data = socket.readData();
- // Handles message code goes here
-
- };
-
- socket.onclose = function() {
- console.log('The socket is closed.');
- serviceSocket = null;
- };
- };
- };
-
- function publishChatService() {
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
- // Error handler
- function(e) {
- console.log( "Could not register service record, Error: " + e.message);
- });
- }
-
- function unregisterChatService() {
- if (chatServiceHandler != null) {
- chatServiceHandler.unregister(function() {
- console.log("Chat service is unregistered");
- chatServiceHandler = null;
- }, function(e) {
- console.log("Failed to unregister service: " + e.message);
- });
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+/* Holds currently registered service record */
+var chatServiceHandler = null;
+/* Holds currently open socket */
+var serviceSocket = null;
+
+function chatServiceSuccessCb(recordHandler)
+{
+ console.log("Chat service registration succeeds!");
+ chatServiceHandler = recordHandler;
+ recordHandler.onconnect = function(socket)
+ {
+ console.log("Client connected: " + socket.peer.name + "," + socket.peer.address);
+ serviceSocket = socket;
+ /* Messages received from remote device */
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handles message code goes here */
+ };
+
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ serviceSocket = null;
+ };
+ };
+};
+
+function publishChatService()
+{
+ var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+ adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
+ /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
+}
+
+function unregisterChatService()
+{
+ if (chatServiceHandler != null)
+ {
+ chatServiceHandler.unregister(function()
+ {
+ console.log("Chat service is unregistered");
+ chatServiceHandler = null;
+ }, function(e)
+ {
+ console.log("Failed to unregister service: " + e.message);
+ });
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::getBluetoothProfileHandler">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler;
- var healthCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.health");
-
- if (healthCapability) {
- healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- } else {
- console.log("Bluetooth Health Profile is not supported on this device.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler;
+var healthCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.health");
+
+if (healthCapability)
+{
+ healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+}
+else
+{
+ console.log("Bluetooth Health Profile is not supported on this device.");
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("[Found device] address: " + device.address);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("[Found device] address: " + device.address);
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEAdapter::stopScan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- adapter.stopScan();
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ adapter.stopScan();
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEAdapter::startAdvertise">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- var battery_svc_uuid_16 = "180f"; // the service UUID, 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
- var heart_rate_svc_uuid_16 = "180d"; // the service solicitation UUID, 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
- var advertiseOptions = {
- includeName: true, // Whether the device name should be included
- includeTxPowerLevel: true, // Whether the transmission power level should be included
- appearance: 192, // The external appearance of device, 192 - Generic Watch
- uuids: [battery_svc_uuid_16],
- solicitationuuids: [heart_rate_svc_uuid_16]
- };
-
- var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
- var connectable = true;
-
- adapter.startAdvertise(
- advertiseData,
- "ADVERTISE",
- function onstate(state) {
- console.log("Advertiser state: " + state);
- },
- function(e) {
- console.log("Failed to startAdvertise : " + e.message);
- },
- "LOW_LATENCY",
- connectable);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+var battery_svc_uuid_16 = "180f"; /* Service UUID, 16-bit UUID is supported (e.g. 180f) */
+var heart_rate_svc_uuid_16 = "180d"; /* Service solicitation UUID, 16-bit UUID is supported (e.g. 180d) */
+var advertiseOptions =
+{
+ includeName: true, /* Whether the device name should be included */
+ includeTxPowerLevel: true, /* Whether the transmission power level should be included */
+ appearance: 192, /* External appearance of device, 192 - Generic Watch */
+ uuids: [battery_svc_uuid_16],
+ solicitationuuids: [heart_rate_svc_uuid_16]
+};
+
+var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
+var connectable = true;
+
+adapter.startAdvertise(advertiseData, "ADVERTISE", function onstate(state)
+{
+ console.log("Advertiser state: " + state);
+}, function(e)
+{
+ console.log("Failed to startAdvertise: " + e.message);
+}, "LOW_LATENCY", connectable);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEAdapter::stopAdvertise">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- var battery_svc_uuid_16 = "180f"; // the service UUID, 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
- var heart_rate_svc_uuid_16 = "180d"; // the service solicitation UUID, 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
- var advertiseOptions = {
- includeName: true, // Whether the device name should be included
- includeTxPowerLevel: true, // Whether the transmission power level should be included
- appearance: 192, // The external appearance of device, 192 - Generic Watch
- uuids: [battery_svc_uuid_16],
- solicitationuuids: [heart_rate_svc_uuid_16]
- };
-
- var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
-
- adapter.startAdvertise(advertiseData, "ADVERTISE",
- function onstate(state) {
- console.log("Advertiser state: " + state);
- });
- adapter.stopAdvertise();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+var battery_svc_uuid_16 = "180f"; /* Service UUID, 16-bit UUID is supported (e.g. 180f) */
+var heart_rate_svc_uuid_16 = "180d"; /* Service solicitation UUID, 16-bit UUID is supported (e.g. 180d) */
+var advertiseOptions =
+{
+ includeName: true, /* Whether the device name should be included */
+ includeTxPowerLevel: true, /* Whether the transmission power level should be included */
+ appearance: 192, /* External appearance of device, 192 - Generic Watch */
+ uuids: [battery_svc_uuid_16],
+ solicitationuuids: [heart_rate_svc_uuid_16]
+};
+
+var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
+
+adapter.startAdvertise(advertiseData, "ADVERTISE", function onstate(state)
+{
+ console.log("Advertiser state: " + state);
+});
+adapter.stopAdvertise();
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onconnected(device) {
- console.log("Connected to device");
- var service = device.getService(device.uuids[0]);
- console.log("Service got");
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("[Found device] address: " + device.address);
- device.connect(onconnected.bind(null, device), onerror);
- });
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onconnected(device)
+{
+ console.log("Connected to device");
+ var service = device.getService(device.uuids[0]);
+ console.log("Service got");
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("[Found device] address: " + device.address);
+ device.connect(onconnected.bind(null, device), onerror);
+});
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service = device.getService(device.uuids[0]);
- console.log("Service UUID " + service.uuid);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service = device.getService(device.uuids[0]);
+console.log("Service UUID " + service.uuid);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothGATTService::services">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service = device.getService(device.uuids[0]);
- for( var i = 0; i service.services.length; ++i) {
- console.log("Subservices UUID " + service.services[i].uuid);
- }
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service = device.getService(device.uuids[0]);
+for (var i = 0; i service.services.length; ++i)
+{
+ console.log("Subservices UUID " + service.services[i].uuid);
+}
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothGATTService::characteristics">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service = device.getService(device.uuids[0]);
- for( var i = 0; i service.characteristics.length; ++i) {
- console.log("Subservices UUID " + service.characteristics[i].isWritable);
- }
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service = device.getService(device.uuids[0]);
+for (var i = 0; i service.characteristics.length; ++i)
+{
+ console.log("Subservices UUID " + service.characteristics[i].isWritable);
+}
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function proccessDevice(device) {
- device.connect(onConnected, onerror);
- function onConnected() {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- characteristic.readValue(function(val) {
- console.log("Value read: " + val);
- device.disconnect();
- });
- }
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function proccessDevice(device)
+{
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ characteristic.readValue(function(val)
+ {
+ console.log("Value read: " + val);
+ device.disconnect();
+ });
+ }
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothGATTCharacteristic::writeValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function proccessDevice(device) {
- device.connect(onConnected, onerror);
- function onConnected() {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- var data = new Array(1, 2, 3, 4, 5, 6);
- characteristic.writeValue(data, function() {
- console.log("Value written");
- device.disconnect();
- }, function(e) {
- console.log("Failed to write: " + e.message);
- });
- }
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function proccessDevice(device)
+{
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var data = new Array(1, 2, 3, 4, 5, 6);
+ characteristic.writeValue(data, function()
+ {
+ console.log("Value written");
+ device.disconnect();
+ }, function(e)
+ {
+ console.log("Failed to write: " + e.message);
+ });
+ }
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothGATTCharacteristic::addValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function proccessDevice(device) {
-
- function onConnected() {
- var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- var watchID;
-
- watchID = characteristic.addValueChangeListener(function(value) {
- console.log("Characteristic value changed: " + value);
- characteristic.removeValueChangeListener(watchID);
- device.disconnect();
- });
- }
- }
-
- device.connect(onConnected);
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- adapter.stopScan();
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function proccessDevice(device)
+{
+ function onConnected()
+ {
+ var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var watchID;
+
+ watchID = characteristic.addValueChangeListener(function(value)
+ {
+ console.log("Characteristic value changed: " + value);
+ characteristic.removeValueChangeListener(watchID);
+ device.disconnect();
+ });
+ }
+ }
+
+ device.connect(onConnected);
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ adapter.stopScan();
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothGATTCharacteristic::removeValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function proccessDevice(device) {
- device.connect(onConnected, onerror);
- function onConnected() {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- var descriptor = characteristic.descriptors[0];
- descriptor.readValue(function(val) {
- console.log("Value read: " + val);
- device.disconnect();
- });
- }
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function proccessDevice(device)
+{
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var descriptor = characteristic.descriptors[0];
+ descriptor.readValue(function(val)
+ {
+ console.log("Value read: " + val);
+ device.disconnect();
+ });
+ }
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothGATTDescriptor::writeValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function proccessDevice(device) {
- device.connect(onConnected, onerror);
- function onConnected() {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- var data = new Array(1, 2, 3, 4, 5, 6);
- var descriptor = characteristic.descriptors[0];
- descriptor.writeValue(data, function() {
- console.log("Value written");
- device.disconnect();
- }, function(e) {
- console.log("Failed to write: " + e.message);
- });
- }
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function proccessDevice(device)
+{
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var data = new Array(1, 2, 3, 4, 5, 6);
+ var descriptor = characteristic.descriptors[0];
+ descriptor.writeValue(data, function()
+ {
+ console.log("Value written");
+ device.disconnect();
+ }, function(e)
+ {
+ console.log("Failed to write: " + e.message);
+ });
+ }
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Device Name: " + device.name);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Device Name: " + device.name);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::address">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Device Address: " + device.address);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Device Address: " + device.address);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::deviceClass">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Device Major Class: " + device.deviceClass.major);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Device Major Class: " + device.deviceClass.major);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::isBonded">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::isTrusted">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::isConnected">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::uuids">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- var uuids = device.uuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++) {
- services += uuids[i] + "\n";
- }
- console.log ("Services found: " + services);
- if (uuids.indexOf(CHAT_SERVICE_UUID) != -1) {
- // Connects to service
- device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket) {
- //
- // Connected to service, handle socket
- //
- }, function (e) {
- console.log("Could not connect to chat service !!!. Error: " + e.message);
- });
- }
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ var uuids = device.uuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Services found: " + services);
+ if (uuids.indexOf(CHAT_SERVICE_UUID) != -1)
+ {
+ /* Connects to service */
+ device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket)
+ {
+ /* Connected to service, handle socket */
+ }, function(e)
+ {
+ console.log("Could not connect to chat service !!!. Error: " + e.message);
+ });
+ }
+});
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var clientSocket = null;
-
- // Calls a method that is invoked when user wants to send a message to a remote device.
- function sendMessage(msg) {
- // Validates socket state, if everything is ok.
- if (clientSocket != null && clientSocket.state == "OPEN") {
- // Sends the message.
- clientSocket.writeData(msg);
- }
- }
-
- // Calls a method that is invoked when a socket is open.
- function onSocketConnected(socket) {
- clientSocket = socket;
- console.log("Opening a socket successfully!!!");
- socket.onmessage = function () {
- var data = socket.readData();
- var recvmsg = "";
- for (var i = 0; i < data.length; i++)
- {
- recvmsg += String.fromCharCode(data[i]);
- }
- console.log("server msg >> " + recvmsg);
- };
-
- socket.onclose = function() {
- console.log("socket disconnected.");
- };
- }
-
- function onDeviceReady(device) {
- // Validates device and service uuid
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1) {
- // Opens socket
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e) {
- console.log ("Error connecting to service. Reason: " + e.message);
- });
- }
- else {
- console.log ("Chat service is not supported by this device");
- }
- }
-
- function onSetPowered() {
- // Gets the BluetoothDevice object.
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) { console.log("Error: " + e.message); });
- }
-
- adapter.setPowered(true, onSetPowered, function(e) {console.log ("Could not turn on Bluetooth adapter. reason: " + e.message); });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var clientSocket = null;
+
+/* Calls a method that is invoked when user wants to send a message to a remote device */
+function sendMessage(msg)
+{
+ /* Validates socket state, if everything is ok */
+ if (clientSocket != null && clientSocket.state == "OPEN")
+ {
+ /* Sends the message */
+ clientSocket.writeData(msg);
+ }
+}
+
+/* Calls a method that is invoked when a socket is open */
+function onSocketConnected(socket)
+{
+ clientSocket = socket;
+ console.log("Opening a socket successfully!!!");
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ var recvmsg = "";
+ for (var i = 0; i < data.length; i++)
+ {
+ recvmsg += String.fromCharCode(data[i]);
+ }
+ console.log("server msg >> " + recvmsg);
+ };
+
+ socket.onclose = function()
+ {
+ console.log("socket disconnected.");
+ };
+}
+
+function onDeviceReady(device)
+{
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e)
+ {
+ console.log("Error connecting to service. Reason: " + e.message);
+ });
+ }
+ else
+ {
+ console.log("Chat service is not supported by this device");
+ }
+}
+
+function onSetPowered()
+{
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+}
+
+adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message); });
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.address);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.address);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::name">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.name);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.name);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::txpowerlevel">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.txpowerlevel);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.txpowerlevel);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::appearance">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.appearance);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.appearance);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::uuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- var uuids = device.uuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++) {
- services += uuids[i] + "\n";
- }
- console.log ("Service found: " + services);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ var uuids = device.uuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Service found: " + services);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::solicitationuuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- var uuids = device.solicitationuuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++) {
- services += uuids[i] + "\n";
- }
- console.log ("Service solicitations found: " + services);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ var uuids = device.solicitationuuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Service solicitations found: " + services);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::serviceData">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- var serviceData = device.serviceData;
- var data = "";
- for (var i = 0; i < serviceData.length; i++) {
- data += serviceData[i].id + serviceData[i].data + "\n";
- }
- console.log ("Service data found: " + data);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ var serviceData = device.serviceData;
+ var data = "";
+ for (var i = 0; i < serviceData.length; i++)
+ {
+ data += serviceData[i].id + serviceData[i].data + "\n";
+ }
+ console.log("Service data found: " + data);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::manufacturerData">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- var manufacturerData = device.manufacturerData;
- console.log ("Manufacture id: " + manufacturerData.id);
- console.log ("Manufacture data: " + manufacturerData.data);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ var manufacturerData = device.manufacturerData;
+ console.log("Manufacture id: " + manufacturerData.id);
+ console.log("Manufacture data: " + manufacturerData.data);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::rssi">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.name);
- console.log("RSSI: " + device.rssi);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.name);
+ console.log("RSSI: " + device.rssi);
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Found device: beacon
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function onconnected() {
- console.log("Connected to device");
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.connect(onconnected, onerror);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function onconnected()
+{
+ console.log("Connected to device");
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected, onerror);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::disconnect">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- function ondisconnect() {
- console.log("Disconnected");
- }
-
- function onconnected() {
- console.log("Connected to device");
- device.disconnect(ondisconnect, onerror);
- }
-
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.connect(onconnected, onerror);
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ function ondisconnect()
+ {
+ console.log("Disconnected");
+ }
+
+ function onconnected()
+ {
+ console.log("Connected to device");
+ device.disconnect(ondisconnect, onerror);
+ }
+
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected, onerror);
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::getService">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onconnected(device) {
- console.log("Connected to device");
- var service = device.getService(device.uuids[0]);
- console.log("Service got");
- }
-
- function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.connect(onconnected.bind(null, device), onerror);
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onconnected(device)
+{
+ console.log("Connected to device");
+ var service = device.getService(device.uuids[0]);
+ console.log("Service got");
+}
+
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected.bind(null, device), onerror);
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::getServiceAllUuids">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onconnected(device) {
- console.log("Connected to device");
- var services = device.getServiceAllUuids();
- console.log("Services length " + services.length);
- }
-
- function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.connect(onconnected.bind(null, device), onerror);
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onconnected(device)
+{
+ console.log("Connected to device");
+ var services = device.getServiceAllUuids();
+ console.log("Services length " + services.length);
+}
+
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected.bind(null, device), onerror);
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::addConnectStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- var onConnectionStateChange = {
- onconnected: function(device) {
- console.log("Device " + device.name + " connected");
- },
- ondisconnected: function(device) {
- console.log("Device " + device.name + " disconnected");
- }
- }
-
- if (device.address === "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.addConnectStateChangeListener(onConnectionStateChange);
- device.connect();
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ var onConnectionStateChange =
+ {
+ onconnected: function(device)
+ {
+ console.log("Device " + device.name + " connected");
+ },
+ ondisconnected: function(device)
+ {
+ console.log("Device " + device.name + " disconnected");
+ }
+ }
+
+ if (device.address === "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.addConnectStateChangeListener(onConnectionStateChange);
+ device.connect();
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::removeConnectStateChangeListener">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- var onConnectionStateChange = {
- onconnected: function(device) {
- console.log("Device " + device.name + " connected");
- },
- ondisconnected: function(device) {
- console.log("Device " + device.name + " disconnected");
- device.removeConnectStateChangeListener(listenerID);
- }
- }
-
- if (device.address === "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
- device.connect();
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- var listenerID = null;
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ var onConnectionStateChange =
+ {
+ onconnected: function(device)
+ {
+ console.log("Device " + device.name + " connected");
+ },
+ ondisconnected: function(device)
+ {
+ console.log("Device " + device.name + " disconnected");
+ device.removeConnectStateChangeListener(listenerID);
+ }
+ }
+
+ if (device.address === "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
+ device.connect();
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+var listenerID = null;
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function onSocketConnected(socket) {
- console.log ("Opened connection to remote device");
- socket.onmessage = function () {
- console.log ("Message received: " + socket.readData());
- };
-
- socket.onclose = function() {
- console.log("Socket closed with " + socket.peer.name);
- };
-
- // Sends data to peer.
- var textmsg = "Test";
- var sendtextmsg = new Array();
- for (var i = 0; i < textmsg.length; i++)
- {
- sendtextmsg[i] = textmsg.charCodeAt(i);
- }
- socket.writeData (sendtextmsg);
- }
-
- function onSocketError(e) {
- console.log ("Error connecting to service. Reason: " + e.message);
- }
-
- function onDeviceReady(device) {
- // Validates device and service uuid.
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1) {
- // Opens socket
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onSocketError );
- }
- }
- function onSetPowered() {
- // Gets the BluetoothDevice object.
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) { console.log("Error: " + e.message); });
- }
-
- adapter.setPowered(true, onSetPowered, function(e) {console.log ("Could not turn on Bluetooth adapter. reason: " + e.message); });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function onSocketConnected(socket)
+{
+ console.log("Opened connection to remote device");
+ socket.onmessage = function()
+ {
+ console.log("Message received: " + socket.readData());
+ };
+
+ socket.onclose = function()
+ {
+ console.log("Socket closed with " + socket.peer.name);
+ };
+
+ /* Sends data to peer */
+ var textmsg = "Test";
+ var sendtextmsg = new Array();
+ for (var i = 0; i < textmsg.length; i++)
+ {
+ sendtextmsg[i] = textmsg.charCodeAt(i);
+ }
+ socket.writeData(sendtextmsg);
+}
+
+function onSocketError(e)
+{
+ console.log("Error connecting to service. Reason: " + e.message);
+}
+
+function onDeviceReady(device)
+{
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onSocketError);
+ }
+}
+
+function onSetPowered()
+{
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+}
+
+adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message);});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothSocket::readData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function onError(e) {
- console.log ("Error connecting to service. Reason: " + e.message);
- }
-
- function onSocketConnected(socket) {
- console.log ("Opening socket success!!!");
-
- socket.onmessage = function() {
- // Gets a message from peer, reads it
- var data = socket.readData();
-
- //
- // Code to evaluate message goes here
- //
- };
-
- socket.onclose = function() {
- console.log("Socket closed with " + socket.peer.name);
- };
- }
-
- function onDeviceReady(device) {
- // Validates device and service uuid
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1) {
- // Opens socket
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onError);
- }
- }
- function onSetPowered() {
- // Gets the BluetoothDevice object.
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) { console.log("Error: " + e.message); });
- }
-
- adapter.setPowered(true, onSetPowered, function(e) {console.log ("Could not turn on Bluetooth adapter. reason: " + e.message); });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function onError(e)
+{
+ console.log("Error connecting to service. Reason: " + e.message);
+}
+
+function onSocketConnected(socket)
+{
+ console.log("Opening socket success!!!");
+
+ socket.onmessage = function()
+ {
+ /* Gets a message from peer, reads it */
+ var data = socket.readData();
+
+ /* Code to evaluate message goes here */
+ };
+
+ socket.onclose = function()
+ {
+ console.log("Socket closed with " + socket.peer.name);
+ };
+}
+
+function onDeviceReady(device)
+{
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onError);
+ }
+}
+
+function onSetPowered()
+{
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+}
+
+adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message);});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothSocket::close">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function evaluateDevice(address) {
- adapter.getDevice(address, function(device) {
- if (device.deviceClass.major == tizen.bluetooth.deviceMajor.COMPUTER) {
- // Shows computer icon for this device
- console.log("Device is computer");
- } else if (device.deviceClass.major == tizen.bluetooth.deviceMajor.PHONE) {
- // Shows phone icon
- console.log("Device is a Phone");
- }
- }, function(e) {
- console.log("Couldn't get any device with the given address: " + e.message);
- });
- }
-
- evaluateDevice("11:22:33:44:55:66");
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function evaluateDevice(address)
+{
+ adapter.getDevice(address, function(device)
+ {
+ if (device.deviceClass.major == tizen.bluetooth.deviceMajor.COMPUTER)
+ {
+ /* Shows computer icon for this device */
+ console.log("Device is computer");
+ }
+ else if (device.deviceClass.major == tizen.bluetooth.deviceMajor.PHONE)
+ {
+ /* Shows phone icon */
+ console.log("Device is a Phone");
+ }
+ }, function(e)
+ {
+ console.log("Couldn't get any device with the given address: " + e.message);
+ });
+}
+
+evaluateDevice("11:22:33:44:55:66");
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothClass::minor">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("12:34:56:78:9A:BC", function(device) {
- if (device.deviceClass.hasService(tizen.bluetooth.deviceService.POSITIONING)) {
- console.log("Device supports Positioning service");
- }
- }, function(e) {
- console.log("Couldn't get device for given address: " + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("12:34:56:78:9A:BC", function(device)
+{
+ if (device.deviceClass.hasService(tizen.bluetooth.deviceService.POSITIONING))
+ {
+ console.log("Device supports Positioning service");
+ }
+}, function(e)
+{
+ console.log("Couldn't get device for given address: " + e.message);
+});
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var chatServiceHandler = null;
-
- function chatServiceSuccessCb(handler) {
- console.log("Chat service registration was successful!");
-
- chatServiceHandler = handler;
- handler.onconnect = function(socket) {
- console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
- socket.onmessage = function() {
- var data = socket.readData();
- // Handle message code goes here
- //....
- };
-
- // Expected close
- socket.onclose = function() {
- console.log('The socket is closed.');
- };
- };
- }
-
- function publishChatService() {
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
- // Error handler
- function(e) {
- console.log( "Could not register service record, Error: " + e.message);
- });
- }
-
- function unRegisterChatService() {
- if (chatServiceHandler != null) {
- chatServiceHandler.unregister(function() {
- chatServiceHandler = null;
- console.log("Chat service is unregistered.");
- },
- function(e) {
- console.log ("Error: " + e.message);
- });
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var chatServiceHandler = null;
+
+function chatServiceSuccessCb(handler)
+{
+ console.log("Chat service registration was successful!");
+
+ chatServiceHandler = handler;
+ handler.onconnect = function(socket)
+ {
+ console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handle message code here */
+ };
+
+ /* Expected close */
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ };
+ };
+}
+
+function publishChatService()
+{
+ var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+ adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
+ /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
+}
+
+function unRegisterChatService()
+{
+ if (chatServiceHandler != null)
+ {
+ chatServiceHandler.unregister(function()
+ {
+ chatServiceHandler = null;
+ console.log("Chat service is unregistered.");
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- }
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+}
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothHealthProfileHandler::connectToSource">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- var registerHealthApp = null;
-
- function healthConnectSuccess(channel) {
- console.log("Health device is connected");
- var status = "Name of remote device: " + channel.peer.name +
- "channel type of device profile: " + channel.channelType +
- "health application name: " + channel.appication.name;
- console.log(status);
- }
-
- function healthConnectError(e) {
- console.log("Failed to connect to source: " + e.message);
- };
-
- function gotDeviceInfo(device) {
- healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess, healthConnectError);
- }
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- registerHealthApp = app;
- adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo);
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+var registerHealthApp = null;
+
+function healthConnectSuccess(channel)
+{
+ console.log("Health device is connected");
+ var status = "Name of remote device: " + channel.peer.name +
+ "channel type of device profile: " + channel.channelType +
+ "health application name: " + channel.appication.name;
+ console.log(status);
+}
+
+function healthConnectError(e)
+{
+ console.log("Failed to connect to source: " + e.message);
+};
+
+function gotDeviceInfo(device)
+{
+ healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess, healthConnectError);
+}
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ registerHealthApp = app;
+ adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo);
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- var healthApp = null;
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- healthApp = app;
- healthApp.onconnect = function(channel) {
- console.log("Connected!!");
- };
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- function startSink() {
- try {
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- } catch(e) {
- console.log("Error: " + e.message);
- }
- }
-
- function stopSink() {
- try {
- if (healthApp != null) {
- healthApp.unregister(function() {
- healthApp = null;
- console.log("Health application is unregistered.");
- },
- function(e) {
- console.log ("Error: " + e.message);
- });
- }
- } catch(err) {
- console.log("Error: " + err.message);
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+var healthApp = null;
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ healthApp = app;
+ healthApp.onconnect = function(channel)
+ {
+ console.log("Connected!!");
+ };
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+function startSink()
+{
+ try
+ {
+ healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+ }
+ catch (e)
+ {
+ console.log("Error: " + e.message);
+ }
+}
+
+function stopSink()
+{
+ try
+ {
+ if (healthApp != null)
+ {
+ healthApp.unregister(function()
+ {
+ healthApp = null;
+ console.log("Health application is unregistered.");
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
+ }
+ catch (err)
+ {
+ console.log("Error: " + err.message);
+ }
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel) {;
- console.log("Health device is connected");
- channel.close();
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.close();
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothHealthChannel::sendData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel) {
- console.log("Health device is connected");
- channel.sendData(dataToSend);
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.sendData(dataToSend);
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothHealthChannel::setListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
-
- var channelCallback = {
- onmessage: function(data) {
- console.log("data is received")
- },
- onclose: function() {
- console.log("channel is closed");
- }
- };
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel) {;
- console.log("Health device is connected");
- channel.setListener(channelCallback);
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+
+var channelCallback =
+{
+ onmessage: function(data)
+ {
+ console.log("data is received")
+ },
+ onclose: function()
+ {
+ console.log("channel is closed");
+ }
+};
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.setListener(channelCallback);
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothHealthChannel::unsetListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- var connectedChannel = null;
-
- var channelCallback = {
- onmessage: function(data) {
- console.log("data is received")
- },
- onclose: function() {
- console.log("channel is closed");
- connectedChannel.unsetListener();
- }
- };
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel) {;
- console.log("Health device is connected");
- connectedChannel = channel;
- connectedChannel.setListener(channelCallback);
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+var connectedChannel = null;
+
+var channelCallback =
+{
+ onmessage: function(data)
+ {
+ console.log("data is received")
+ },
+ onclose: function()
+ {
+ console.log("channel is closed");
+ connectedChannel.unsetListener();
+ }
+};
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ connectedChannel = channel;
+ connectedChannel.setListener(channelCallback);
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Retrieves bookmarks from the root bookmark folder recursively.
- var allBookmarks = tizen.bookmark.get(null, true);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Retrieves bookmarks from the root bookmark folder recursively */
+ var allBookmarks = tizen.bookmark.get(null, true);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="BookmarkManager::add">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Adds a bookmark item to root bookmark folder.
- tizen.bookmark.add(new tizen.BookmarkItem("tizen", "https://www.tizen.org"));
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Adds a bookmark item to root bookmark folder */
+ tizen.bookmark.add(new tizen.BookmarkItem("tizen", "https://www.tizen.org"));
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="BookmarkManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Removes all the bookmark folders and items.
- tizen.bookmark.remove();
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Removes all the bookmark folders and items */
+ tizen.bookmark.remove();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
<dl>
<pre class="webidl prettyprint">BookmarkItem(DOMString title, DOMString url);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Creates a bookmark item.
- var tizen = new tizen.BookmarkItem("tizen", "https://www.tizen.org");
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Creates a bookmark item */
+ var tizen = new tizen.BookmarkItem("tizen", "https://www.tizen.org");
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dl>
</div>
<dl>
<pre class="webidl prettyprint">BookmarkFolder(DOMString title);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // creates a bookmark folder
- var folder = new tizen.BookmarkFolder("folder");
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Creates a bookmark folder */
+ var folder = new tizen.BookmarkFolder("folder");
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dl>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var calendar;
-
- function eventFoundCallback(events) {
- // The event has been successfully found.
- // Changes the summary.
- events[0].summary = 'HTML6 Webinar';
- calendar.update(events[0]);
- console.log('First event was updated!');
- }
-
- // Defines the error callback for all the asynchronous calls.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // Defines the success callback for retrieving the list of calendars.
- function calendarListCallback(calendars) {
- if(calendars.length > 0) {
- calendar = calendars[0];
- console.log('The calendar id is ' + calendar.id + ' and name ' + calendar.name);
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
- calendar.add(ev);
-
- // The event has been successfully added.
- // Checks whether the added event can be retrieved from the calendar.
- // If the calendar was empty, only the item added through add() should be returned.
- var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
- calendar.find(eventFoundCallback, errorCallback, filter);
- }
- }
-
- // Gets a list of available calendars.
- tizen.calendar.getCalendars("EVENT", calendarListCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var calendar;
+
+function eventFoundCallback(events)
+{
+ /* Event has been successfully found */
+ /* Changes the summary */
+ events[0].summary = 'HTML6 Webinar';
+ calendar.update(events[0]);
+ console.log('First event was updated!');
+}
+
+/* Defines the error callback for all the asynchronous calls */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* Defines the success callback for retrieving the list of calendars */
+function calendarListCallback(calendars)
+{
+ if (calendars.length > 0)
+ {
+ calendar = calendars[0];
+ console.log('The calendar id is ' + calendar.id + ' and name ' + calendar.name);
+
+ var ev = new tizen.CalendarEvent(
+ {
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+ });
+ calendar.add(ev);
+
+ /* Event has been successfully added */
+ /* Checks whether the added event can be retrieved from the calendar */
+ /* If the calendar was empty, only the item added through add() should be returned */
+ var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
+ calendar.find(eventFoundCallback, errorCallback, filter);
+ }
+}
+
+/* Gets a list of available calendars */
+tizen.calendar.getCalendars("EVENT", calendarListCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="CalendarManager::getUnifiedCalendar">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var unifiedCalendar;
-
- // Defines the error callback for all the asynchronous calls.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- function eventFoundCallback(events) {
- // The event has been successfully found.
- // Changes the summary.
- events[0].summary = 'HTML6 Webinar';
- unifiedCalendar.update(events[0]);
- console.log('First event was updated!');
- }
-
- // Gets the unified calendar.
- unifiedCalendar = tizen.calendar.getUnifiedCalendar("EVENT");
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
-
- unifiedCalendar.add(ev);
-
- // The event has been added.
- // Checks whether the added event can be retrieved from the calendar.
- // If the calendar was empty, only the item added through add() should be returned.
- var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
- unifiedCalendar.find(eventFoundCallback, errorCallback, filter);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var unifiedCalendar;
+
+/* Defines the error callback for all the asynchronous calls */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+function eventFoundCallback(events)
+{
+ /* Event has been successfully found */
+ /* Changes the summary */
+ events[0].summary = 'HTML6 Webinar';
+ unifiedCalendar.update(events[0]);
+ console.log('First event was updated!');
+}
+
+/* Gets the unified calendar */
+unifiedCalendar = tizen.calendar.getUnifiedCalendar("EVENT");
+
+var ev = new tizen.CalendarEvent(
+{
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+});
+
+unifiedCalendar.add(ev);
+
+/* Event has been added */
+/* Checks whether the added event can be retrieved from the calendar */
+/* If the calendar was empty, only the item added through add() should be returned */
+var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
+unifiedCalendar.find(eventFoundCallback, errorCallback, filter);
+</pre>
</div>
</dd>
<dt class="method" id="CalendarManager::getDefaultCalendar">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCalendar;
-
- // Defines the error callback for all the asynchronous calls.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- function eventFoundCallback(events) {
- // The event has been successfully found.
- // Changes the summary.
- events[0].summary = 'HTML6 Webinar';
- myCalendar.update(events[0]);
- console.log('First event was updated!');
- }
-
- // Gets the default calendar.
- myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
-
- myCalendar.add(ev);
-
- // The event has been added.
- // Checks whether the added event can be retrieved from the calendar.
- // If the calendar was empty, only the item added through add() should be returned.
- var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
- myCalendar.find(eventFoundCallback, errorCallback, filter);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCalendar;
+
+/* Defines the error callback for all the asynchronous calls */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+function eventFoundCallback(events)
+{
+ /* Event has been successfully found */
+ /* Changes the summary */
+ events[0].summary = 'HTML6 Webinar';
+ myCalendar.update(events[0]);
+ console.log('First event was updated!');
+}
+
+/* Gets the default calendar */
+myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+var ev = new tizen.CalendarEvent(
+{
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+});
+
+myCalendar.add(ev);
+
+/* Event has been added */
+/* Checks whether the added event can be retrieved from the calendar */
+/* If the calendar was empty, only the item added through add() should be returned */
+var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
+myCalendar.find(eventFoundCallback, errorCallback, filter);
+</pre>
</div>
</dd>
<dt class="method" id="CalendarManager::addCalendar">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- var calendar = new tizen.Calendar(
- account.id,
- 'remote calendar',
- 'TASK'
- );
- tizen.calendar.addCalendar(calendar);
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ var calendar = new tizen.Calendar(account.id,
+ 'remote calendar', 'TASK');
+ tizen.calendar.addCalendar(calendar);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
<dt class="method" id="CalendarManager::removeCalendar">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- var calendar = new tizen.Calendar(
- account.id,
- 'remote calendar',
- 'TASK'
- );
- tizen.calendar.addCalendar(calendar);
- tizen.calendar.removeCalendar('TASK', calendar.id);
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ var calendar = new tizen.Calendar(account.id,
+ 'remote calendar', 'TASK');
+ tizen.calendar.addCalendar(calendar);
+ tizen.calendar.removeCalendar('TASK', calendar.id);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
<dt class="method" id="CalendarManager::getCalendar">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var calendarId; // calendarId supposed to be initialized
- try {
- var calendar = tizen.calendar.getCalendar("EVENT", calendarId);
- console.log("Successfully retrieved event calendar with id: " + calendarId);
- } catch(err) {
- console.log("Error: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var calendarId; /* calendarId supposed to be initialized */
+try
+{
+ var calendar = tizen.calendar.getCalendar("EVENT", calendarId);
+ console.log("Successfully retrieved event calendar with id: " + calendarId);
+}
+catch (err)
+{
+ console.log("Error: " + err.name);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- var calendar = new tizen.Calendar(
- account.id,
- 'remote calendar',
- 'TASK'
- );
- // 'calendar' variable is not available until it is inserted into the database.
- tizen.calendar.addCalendar(calendar);
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ var calendar = new tizen.Calendar(account.id,
+ 'remote calendar', 'TASK');
+ /* 'calendar' variable is not available until it is inserted into the database */
+ tizen.calendar.addCalendar(calendar);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
<div class="constructors">
<h4 id="Calendar::constructor">Constructors</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the default calendar and show its name.
- var calendar = tizen.calendar.getDefaultCalendar("EVENT");
- console.log('The calendar name is ' + calendar.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the default calendar and shows its name */
+var calendar = tizen.calendar.getDefaultCalendar("EVENT");
+console.log('The calendar name is ' + calendar.name);
+</pre>
</div>
</li>
<li class="attribute" id="Calendar::accountId">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCalendar; // Calendar supposed to be initialized
- var itemId; // Calendar item identifier
- try {
- var item = myCalendar.get(itemId);
- console.log("Successfully retrieved item with id: " + itemId);
- } catch(err) {
- console.log("Error: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCalendar; /* Calendar supposed to be initialized */
+var itemId; /* Calendar item identifier */
+try
+{
+ var item = myCalendar.get(itemId);
+ console.log("Successfully retrieved item with id: " + itemId);
+}
+catch (err)
+{
+ console.log("Error: " + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::add">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the default calendar.
- var calendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
-
- calendar.add(ev);
- console.log('Event added with uid ' + ev.id.uid);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the default calendar */
+var calendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+var ev = new tizen.CalendarEvent(
+{
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+});
+
+calendar.add(ev);
+console.log('Event added with uid ' + ev.id.uid);
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::addBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- function addEventsSuccess(events) {
- console.log("Successfully added " + events.length + " events!");
- }
-
- // Gets the default calendar.
- var calendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
-
- calendar.addBatch([ev], addEventsSuccess, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+function addEventsSuccess(events)
+{
+ console.log("Successfully added " + events.length + " events!");
+}
+
+/* Gets the default calendar */
+var calendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+var ev = new tizen.CalendarEvent(
+{
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+});
+
+calendar.addBatch([ev], addEventsSuccess, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCalendar;
-
- // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // Defines the event success callback.
- function eventSearchSuccessCallback(events) {
- events[0].description = 'New Description';
- // Updates the first existing event.
- myCalendar.update(events[0]);
- console.log("The first item description was updated!");
- }
-
- // Gets the default calendar.
- myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- // Finds all events in a Calendar.
- myCalendar.find(eventSearchSuccessCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCalendar;
+
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* Defines the event success callback */
+function eventSearchSuccessCallback(events)
+{
+ events[0].description = 'New Description';
+ /* Updates the first existing event */
+ myCalendar.update(events[0]);
+ console.log("The first item description was updated!");
+}
+
+/* Gets the default calendar */
+myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+/* Finds all events in a Calendar */
+myCalendar.find(eventSearchSuccessCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::updateBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCalendar;
-
- // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // Defines the success callback.
- function updateEventsSuccess() {
- console.log("Successfully updated !" );
- }
-
- // Defines the event success callback.
- function eventSearchSuccessCallback(events) {
- events[0].description = 'New Description 1';
- events[1].description = 'New Description 2';
- // Updates the first two existing events.
- myCalendar.updateBatch(events.slice(0,2), updateEventsSuccess, errorCallback);
- }
-
- // Gets the default calendar.
- myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- // Finds all events in Calendar.
- myCalendar.find(eventSearchSuccessCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCalendar;
+
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* Defines the success callback */
+function updateEventsSuccess()
+{
+ console.log("Successfully updated !");
+}
+
+/* Defines the event success callback */
+function eventSearchSuccessCallback(events)
+{
+ events[0].description = 'New Description 1';
+ events[1].description = 'New Description 2';
+ /* Updates the first two existing events */
+ myCalendar.updateBatch(events.slice(0,2), updateEventsSuccess, errorCallback);
+}
+
+/* Gets the default calendar */
+myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+/* Finds all events in Calendar */
+myCalendar.find(eventSearchSuccessCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCalendar;
-
- // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // Defines the event success callback.
- function eventSearchSuccessCallback(events) {
- // Deletes the first existing event.
- myCalendar.remove(events[0].id);
- console.log('The first event was removed');
- }
-
- // Gets default calendar.
- myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- // Finds all events in Calendar.
- myCalendar.find(eventSearchSuccessCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCalendar;
+
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* Defines the event success callback */
+function eventSearchSuccessCallback(events)
+{
+ /* Deletes the first existing event */
+ myCalendar.remove(events[0].id);
+ console.log('The first event was removed');
+}
+
+/* Gets default calendar */
+myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+/* Finds all events in Calendar */
+myCalendar.find(eventSearchSuccessCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::removeBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCalendar;
-
- // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // Defines the removeBatch callback.
- function removeBatchCallback() {
- console.log("Requested events were successfully removed.");
- }
-
- // Defines the event search success callback.
- function eventSearchSuccessCallback(events) {
- // Deletes the first two existing events.
- myCalendar.removeBatch([events[0].id, events[1].id],
- removeBatchCallback,
- errorCallback);
- }
-
- // Gets the default calendar.
- myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- // Retrieves all the events in Calendar.
- myCalendar.find(eventSearchSuccessCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCalendar;
+
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* Defines the removeBatch callback */
+function removeBatchCallback()
+{
+ console.log("Requested events were successfully removed.");
+}
+
+/* Defines the event search success callback */
+function eventSearchSuccessCallback(events)
+{
+ /* Deletes the first two existing events */
+ myCalendar.removeBatch([events[0].id, events[1].id],
+ removeBatchCallback, errorCallback);
+}
+
+/* Gets the default calendar */
+myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+/* Retrieves all the events in Calendar */
+myCalendar.find(eventSearchSuccessCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::find">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
- // Defines the event search success callback.
- function eventSearchSuccessCallback(events) {
- console.log(events.length + ' results found.');
- }
+/* Defines the event search success callback */
+function eventSearchSuccessCallback(events)
+{
+ console.log(events.length + ' results found.');
+}
- // Gets the default calendar.
- var calendar = tizen.calendar.getDefaultCalendar("EVENT");
+/* Gets the default calendar */
+var calendar = tizen.calendar.getDefaultCalendar("EVENT");
- // Finds all events the calendar that contain in the summary the string Tizen.
- var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'Tizen');
+/* Finds all events the calendar that contain in the summary the string Tizen */
+var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'Tizen');
- // The events returned by the find() query will be sorted by ascending summary.
- var sortingMode = new tizen.SortMode('summary', 'ASC');
+/* Events returned by the find() query will be sorted by ascending summary */
+var sortingMode = new tizen.SortMode('summary', 'ASC');
- calendar.find(eventSearchSuccessCallback, errorCallback, filter, sortingMode);
- </pre>
+calendar.find(eventSearchSuccessCallback, errorCallback, filter, sortingMode);
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::addChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var calendar; // This example assumes calendar is initialized
-
- var watcher = {
- onitemsadded: function(items) {
- console.log(items.length + ' items were added');
- },
- onitemsupdated: function(items) {
- console.log(items.length + ' items were updated');
- },
- onitemsremoved: function(ids) {
- console.log(ids.length + ' items were removed');
- }
- };
-
- // Registers to be notified when the calendar changes.
- watcherId = calendar.addChangeListener(watcher);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var calendar; /* This example assumes calendar is initialized */
+
+var watcher =
+{
+ onitemsadded: function(items)
+ {
+ console.log(items.length + ' items were added');
+ },
+ onitemsupdated: function(items)
+ {
+ console.log(items.length + ' items were updated');
+ },
+ onitemsremoved: function(ids)
+ {
+ console.log(ids.length + ' items were removed');
+ }
+};
+
+/* Registers to be notified when the calendar changes */
+watcherId = calendar.addChangeListener(watcher);
+</pre>
</div>
</dd>
<dt class="method" id="Calendar::removeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var calendar; // This example assumes calendar is initialized.
-
- // Receives calendar changes.
- var watcher = {
- onitemsadded: function(items) {
- console.log(items.length + ' items were added');
- },
- onitemsupdated: function(items) {
- console.log(evitemsents.length + ' items were updated');
- },
- onitemsremoved: function(ids) {
- console.log(ids.length + ' items were removed');
- }
- };
-
- // Registers to be notified when the calendar changes.
- watcherId = calendar.addChangeListener(watcher);
-
- // Cancels the watch operation.
- calendar.removeChangeListener(watcherId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var calendar; /* This example assumes calendar is initialized */
+
+/* Receives calendar changes */
+var watcher =
+{
+ onitemsadded: function(items)
+ {
+ console.log(items.length + ' items were added');
+ },
+ onitemsupdated: function(items)
+ {
+ console.log(evitemsents.length + ' items were updated');
+ },
+ onitemsremoved: function(ids)
+ {
+ console.log(ids.length + ' items were removed');
+ }
+};
+
+/* Registers to be notified when the calendar changes */
+watcherId = calendar.addChangeListener(watcher);
+
+/* Cancels the watch operation */
+calendar.removeChangeListener(watcherId);
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> event.description = 'Tizen Codefest';
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+event.description = 'Tizen Codefest';
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::summary">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> event.summary = 'Launching the Tizen reference implementation';
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+event.summary = 'Launching the Tizen reference implementation';
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::isAllDay">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> event.isAllDay = true; // All-Day event
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+event.isAllDay = true; /* All-day event */
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::startDate">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 2010-04-30 09:00
- event.startDate = new tizen.TZDate(2010, 3, 30, 9, 0);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 2010-04-30 09:00 */
+event.startDate = new tizen.TZDate(2010, 3, 30, 9, 0);
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::duration">
Note that the implementation may not save the duration itself, rather convert it to the corresponding endDate/dueDate attribute and save it. For example, if you set the startDate and the duration attributes and save the item, you may see that the duration is <var>null</var> while endDate/dueDate is non-null after retrieving it because the implementation has calculated the endDate/dueDate based on the duration and the startDate then saved it, not the duration.
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 1 hour meeting
- event.duration = new tizen.TimeDuration(1, "HOURS");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 1 hour meeting */
+event.duration = new tizen.TimeDuration(1, "HOURS");
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::location">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> event.location = 'Huesca';
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+event.location = 'Huesca';
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::geolocation">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> event.geolocation = new tizen.SimpleCoordinates(60.175, 24.934);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+event.geolocation = new tizen.SimpleCoordinates(60.175, 24.934);
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::organizer">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> event.organizer = 'Mr. Jones';
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+event.organizer = 'Mr. Jones';
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::visibility">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> event.status = "TENTATIVE";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+event.status = "TENTATIVE";
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::priority">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> task.priority = "HIGH";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+task.priority = "HIGH";
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::alarms">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> ev.startDate = new tizen.TZDate(2011, 2, 11, 8, 0, 0);
- // Gives a sound notification 30 minutes before the item's start time.
- var alarm = new tizen.CalendarAlarm(new tizen.TimeDuration(30, "MINS"),
- "SOUND");
- ev.alarms = [alarm];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+ev.startDate = new tizen.TZDate(2011, 2, 11, 8, 0, 0);
+/* Gives a sound notification 30 minutes before the item's start time */
+var alarm = new tizen.CalendarAlarm(new tizen.TimeDuration(30, "MINS"),
+ "SOUND");
+ev.alarms = [alarm];
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::categories">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> event.categories = ['Personal'];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+event.categories = ['Personal'];
+</pre>
</div>
</li>
<li class="attribute" id="CalendarItem::attendees">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
- {role: "CHAIR", RSVP: true});
- event.attendees = [attendee];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
+ {role: "CHAIR", RSVP: true});
+event.attendees = [attendee];
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the event search success callback.
- function eventSearchSuccessCallback(events) {
- // Converts the first event to iCalendar 2.0 format (default).
- var vevent = events[0].convertToString("ICALENDAR_20");
- console.log('iCalendar 2.0 representation of the event is: ' + vevent);
- }
-
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // Gets the default calendar.
- var myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- // Finds all events in the first calendar that contain in the summary the string Tizen.
- var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'Tizen');
- myCalendar.find(eventSearchSuccessCallback, errorCallback, filter);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the event search success callback */
+function eventSearchSuccessCallback(events)
+{
+ /* Converts the first event to iCalendar 2.0 format (default) */
+ var vevent = events[0].convertToString("ICALENDAR_20");
+ console.log('iCalendar 2.0 representation of the event is: ' + vevent);
+}
+
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* Gets the default calendar */
+var myCalendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+/* Finds all events in the first calendar that contain in the summary the string Tizen */
+var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'Tizen');
+myCalendar.find(eventSearchSuccessCallback, errorCallback, filter);
+</pre>
</div>
</dd>
<dt class="method" id="CalendarItem::clone">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the default calendar.
- var calendar = tizen.calendar.getDefaultCalendar();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the default calendar */
+var calendar = tizen.calendar.getDefaultCalendar();
- var html5seminar = new tizen.CalendarEvent({startDate: new tizen.TZDate(2012, 3, 4),
- duration: new tizen.TimeDuration(3, "DAYS"),
- summary: "HTML5 Seminar"});
+var html5seminar = new tizen.CalendarEvent({startDate: new tizen.TZDate(2012, 3, 4),
+ duration: new tizen.TimeDuration(3, "DAYS"),
+ summary: "HTML5 Seminar"});
- calendar.add(html5seminar);
- var tizenseminar = html5seminar.clone();
- tizenseminar.summary = "Tizen Seminar";
- calendar.add(tizenseminar);
- </pre>
+calendar.add(html5seminar);
+var tizenseminar = html5seminar.clone();
+tizenseminar.summary = "Tizen Seminar";
+calendar.add(tizenseminar);
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var taskCalendar, task;
-
- try {
- var task = new tizen.CalendarTask("BEGIN:VCALENDAR\r\n" +
- "VERSION:2.0\r\n" +
- "BEGIN:VTODO\r\n" +
- "DTSTAMP:TZID=CET:20110902T110000Z\r\n" +
- "DTSTART;TZID=CET:20110906T140000Z\r\n" +
- "DUE;TZID=CET:20110906T150000Z\r\n" +
- "SUMMARY:Discuss the schedule\r\n" +
- "DESCRIPTION:Find the feasible schedule\r\n" +
- "CATEGORIES:HUMAN RESOURCES\r\n" +
- "END:VTODO\r\n" +
- "END:VCALENDAR", "ICALENDAR_20");
-
- taskCalendar = tizen.calendar.getDefaultCalendar("TASK");
- taskCalendar.add(task);
- console.log("Task added with ID " + task.id);
- } catch (err) {
- console.log("Failed to add VTODO to the calendar, error: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var taskCalendar, task;
+
+try
+{
+ var task = new tizen.CalendarTask("BEGIN:VCALENDAR\r\n" +
+ "VERSION:2.0\r\n" +
+ "BEGIN:VTODO\r\n" +
+ "DTSTAMP:TZID=CET:20110902T110000Z\r\n" +
+ "DTSTART;TZID=CET:20110906T140000Z\r\n" +
+ "DUE;TZID=CET:20110906T150000Z\r\n" +
+ "SUMMARY:Discuss the schedule\r\n" +
+ "DESCRIPTION:Find the feasible schedule\r\n" +
+ "CATEGORIES:HUMAN RESOURCES\r\n" +
+ "END:VTODO\r\n" +
+ "END:VCALENDAR", "ICALENDAR_20");
+
+ taskCalendar = tizen.calendar.getDefaultCalendar("TASK");
+ taskCalendar.add(task);
+ console.log("Task added with ID " + task.id);
+}
+catch (err)
+{
+ console.log("Failed to add VTODO to the calendar, error: " + err.name);
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var taskInit = { description: "HTML5 Introduction",
- summary: "HTML5 Webinar",
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- dueDate: new tizen.TZDate(2011, 5, 30, 10, 0),
- completedDate: new tizen.TZDate(2011, 4, 30, 10, 0),
- progress: "0" };
-
- var ev = new tizen.CalendarTask(taskInit);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var taskInit =
+{
+ description: "HTML5 Introduction",
+ summary: "HTML5 Webinar",
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ dueDate: new tizen.TZDate(2011, 5, 30, 10, 0),
+ completedDate: new tizen.TZDate(2011, 4, 30, 10, 0),
+ progress: "0"
+};
+
+var ev = new tizen.CalendarTask(taskInit);
+</pre>
</div>
<div class="constructors">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> task.dueDate = new tizen.TZDate(2011, 2, 11);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+task.dueDate = new tizen.TZDate(2011, 2, 11);
+</pre>
</div>
</li>
<li class="attribute" id="CalendarTask::completedDate">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> task.completedDate = new tizen.TZDate(2011, 2, 11);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+task.completedDate = new tizen.TZDate(2011, 2, 11);
+</pre>
</div>
</li>
<li class="attribute" id="CalendarTask::progress">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> task.progress = 50; // 50% done
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+task.progress = 50; /* 50% done */
+</pre>
</div>
</li>
</ul>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the default calendar.
- var calendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- try {
- var ev = new tizen.CalendarEvent("BEGIN:VCALENDAR\r\n" +
- "BEGIN:VEVENT\r\n" +
- "DTSTAMP:19970901T1300Z\r\n" +
- "DTSTART:19970903T163000Z\r\n" +
- "DTEND:19970903T190000Z\r\n" +
- "SUMMARY:Annual Employee Review\r\n" +
- "CATEGORIES:BUSINESS,HUMAN RESOURCES\r\n" +
- "END:VEVENT\r\n" +
- "END:VCALENDAR", "ICALENDAR_20");
-
- calendar.add(ev);
- console.log('Event added with UID ' + ev.id.uid);
- } catch (err) {
- console.log("Failed to add VEVENT to the calendar, error: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the default calendar */
+var calendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+try
+{
+ var ev = new tizen.CalendarEvent("BEGIN:VCALENDAR\r\n" +
+ "BEGIN:VEVENT\r\n" +
+ "DTSTAMP:19970901T1300Z\r\n" +
+ "DTSTART:19970903T163000Z\r\n" +
+ "DTEND:19970903T190000Z\r\n" +
+ "SUMMARY:Annual Employee Review\r\n" +
+ "CATEGORIES:BUSINESS,HUMAN RESOURCES\r\n" +
+ "END:VEVENT\r\n" +
+ "END:VCALENDAR", "ICALENDAR_20");
+
+ calendar.add(ev);
+ console.log('Event added with UID ' + ev.id.uid);
+}
+catch (err)
+{
+ console.log("Failed to add VEVENT to the calendar, error: " + err.name);
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var eventInit = { description: "HTML5 Introduction",
- summary: "HTML5 Webinar",
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location: "Huesca" };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var eventInit =
+{
+ description: "HTML5 Introduction",
+ summary: "HTML5 Webinar",
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location: "Huesca"
+};
- var ev = new tizen.CalendarEvent(eventInit);
- </pre>
+var ev = new tizen.CalendarEvent(eventInit);
+</pre>
</div>
<div class="constructors">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 2010-04-30 09:00
- event.endDate = new tizen.TZDate(2010, 3, 30, 9, 0);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 2010-04-30 09:00 */
+event.endDate = new tizen.TZDate(2010, 3, 30, 9, 0);
+</pre>
</div>
</li>
<li class="attribute" id="CalendarEvent::availability">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Repeats daily for 7 days.
- var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount: 7});
- event.recurrenceRule = rule;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Repeats daily for 7 days */
+var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount: 7});
+event.recurrenceRule = rule;
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // eventId should be set to ID of event obtained with the find function.
- var eventId;
- // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // Defines the event expanding success callback.
- function eventExpandingSuccessCallback(events) {
- console.log(events.length + ' event instances were returned.');
- }
-
- var calendar = tizen.calendar.getDefaultCalendar();
- var event = calendar.get(eventId);
-
- if (event.recurrenceRule != null) {
- // This is a recurring event. Expands all the instances during August 2011.
- event.expandRecurrence(new tizen.TZDate(2011, 7, 1),
- new tizen.TZDate(2011, 7, 31),
- eventExpandingSuccessCallback,
- errorCallback);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* eventId should be set to ID of event obtained with the find function */
+var eventId;
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* Defines the event expanding success callback */
+function eventExpandingSuccessCallback(events)
+{
+ console.log(events.length + ' event instances were returned.');
+}
+
+var calendar = tizen.calendar.getDefaultCalendar();
+var event = calendar.get(eventId);
+
+if (event.recurrenceRule != null)
+{
+ /* This is a recurring event. Expands all the instances during August 2011 */
+ event.expandRecurrence(new tizen.TZDate(2011, 7, 1), new tizen.TZDate(2011, 7, 31),
+ eventExpandingSuccessCallback, errorCallback);
+}
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
- {role: "CHAIR", RSVP: true});
- event.attendees = [attendee];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
+ {role: "CHAIR", RSVP: true});
+event.attendees = [attendee];
+</pre>
</div>
<div class="constructors">
<h4 id="CalendarAttendee::constructor">Constructors</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Repeats daily for 7 days.
- var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount:7});
- event.recurrenceRule = rule;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Repeats daily for 7 days */
+var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount:7});
+event.recurrenceRule = rule;
+</pre>
</div>
<div class="constructors">
<h4 id="CalendarRecurrenceRule::constructor">Constructors</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a sound alarm at the specified time
- var alarm1 = new tizen.CalendarAlarm(new tizen.TZDate(2011, 3, 30, 10, 0), "SOUND");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a sound alarm at the specified time */
+var alarm1 = new tizen.CalendarAlarm(new tizen.TZDate(2011, 3, 30, 10, 0), "SOUND");
- // Creates a sound alarm before an event starts
- var alarm2 = new tizen.CalendarAlarm(new tizen.TimeDuration(1, "MINS"), "SOUND");
- </pre>
+/* Creates a sound alarm before an event starts */
+var alarm2 = new tizen.CalendarAlarm(new tizen.TimeDuration(1, "MINS"), "SOUND");
+</pre>
</div>
<div class="constructors">
<h4 id="CalendarAlarm::constructor">Constructors</h4>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // eventId should be set to ID of event obtained with the find function.
- var eventId;
- // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // CalendarEventArraySuccessCallback instance
- function calendarEventArraySuccessCB(events) {
- console.log(events.length + ' event instances were returned.');
- }
-
- var calendar = tizen.calendar.getDefaultCalendar();
- var event = calendar.get(eventId);
-
- if (event.recurrenceRule != null) {
- // This is a recurring event. Expands all the instances during August 2011.
- event.expandRecurrence(new tizen.TZDate(2011, 7, 1),
- new tizen.TZDate(2011, 7, 31),
- calendarEventArraySuccessCB,
- errorCallback);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* eventId should be set to ID of event obtained with the find function */
+var eventId;
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* CalendarEventArraySuccessCallback instance */
+function calendarEventArraySuccessCB(events)
+{
+ console.log(events.length + ' event instances were returned.');
+}
+
+var calendar = tizen.calendar.getDefaultCalendar();
+var event = calendar.get(eventId);
+
+if (event.recurrenceRule != null)
+{
+ /* This is a recurring event. Expands all the instances during August 2011 */
+ event.expandRecurrence(new tizen.TZDate(2011, 7, 1), new tizen.TZDate(2011, 7, 31),
+ calendarEventArraySuccessCB, errorCallback);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // CalendarItemArraySuccessCallback instance
- function calendarItemArraySuccessCB(events) {
- console.log("Successfully added " + events.length + " events!");
- }
-
- // Gets the default calendar.
- var calendar = tizen.calendar.getDefaultCalendar("EVENT");
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
-
- calendar.addBatch([ev], calendarItemArraySuccessCB, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* CalendarItemArraySuccessCallback instance */
+function calendarItemArraySuccessCB(events)
+{
+ console.log("Successfully added " + events.length + " events!");
+}
+
+/* Gets the default calendar */
+var calendar = tizen.calendar.getDefaultCalendar("EVENT");
+
+var ev = new tizen.CalendarEvent(
+{
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+});
+
+calendar.addBatch([ev], calendarItemArraySuccessCB, errorCallback);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var calendar;
-
- function eventFoundCallback(events) {
- // The event has been successfully found.
- // Changes the summary.
- events[0].summary = 'HTML6 Webinar';
- calendar.update(events[0]);
- console.log('First event was updated!');
- }
-
- // Defines the error callback for all the asynchronous calls.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
-
- // CalendarArraySuccessCallback instance
- function calendarArraySuccessCB(calendars) {
- if(calendars.length > 0) {
- calendar = calendars[0];
- console.log('The calendar id is ' + calendar.id + ' and name ' + calendar.name);
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
- calendar.add(ev);
-
- // The event has been successfully added.
- // Checks whether the added event can be retrieved from the calendar.
- // If the calendar was empty, only the item added through add() should be returned.
- var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
- calendar.find(eventFoundCallback, errorCallback, filter);
- }
- }
-
- // Gets a list of available calendars.
- tizen.calendar.getCalendars("EVENT", calendarArraySuccessCB, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var calendar;
+
+function eventFoundCallback(events)
+{
+ /* Event has been successfully found */
+ /* Changes the summary */
+ events[0].summary = 'HTML6 Webinar';
+ calendar.update(events[0]);
+ console.log('First event was updated!');
+}
+
+/* Defines the error callback for all the asynchronous calls */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
+
+/* CalendarArraySuccessCallback instance */
+function calendarArraySuccessCB(calendars)
+{
+ if (calendars.length > 0)
+ {
+ calendar = calendars[0];
+ console.log('The calendar id is ' + calendar.id + ' and name ' + calendar.name);
+
+ var ev = new tizen.CalendarEvent(
+ {
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+ });
+ calendar.add(ev);
+
+ /* Event has been successfully added */
+ /* Checks whether the added event can be retrieved from the calendar */
+ /* If the calendar was empty, only the item added through add() should be returned */
+ var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
+ calendar.find(eventFoundCallback, errorCallback, filter);
+ }
+}
+
+/* Gets a list of available calendars */
+tizen.calendar.getCalendars("EVENT", calendarArraySuccessCB, errorCallback);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var calendar; // This example assumes calendar is initialized
-
- var watcher = {
- onitemsadded: function(items) {
- console.log('New item ' + items[0].id + ' added');
- },
- onitemsupdated: function(items) {
- // ...
- },
- onitemsremoved: function(ids) {
- // ...
- }
- };
-
- // Registers to be notified when the calendar changes.
- watcherId = calendar.addChangeListener(watcher);
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var calendar; /* This example assumes calendar is initialized */
+
+var watcher =
+{
+ onitemsadded: function(items)
+ {
+ console.log('New item ' + items[0].id + ' added');
+ },
+ onitemsupdated: function(items)
+ {
+ /* Do something */
+ },
+ onitemsremoved: function(ids)
+ {
+ /* Do something */
+ }
+};
+
+/* Registers to be notified when the calendar changes */
+watcherId = calendar.addChangeListener(watcher);
+
+var ev = new tizen.CalendarEvent(
+{
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+});
+</pre>
</div>
</dd>
<dt class="method" id="CalendarChangeCallback::onitemsupdated">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var calendar; // This example assumes calendar is initialized
-
- var watcher = {
- onitemsadded: function(items) {
- if (calendar.update) {
- items[0].location = 'New York';
- calendar.update(items[0]);
- }
- },
- onitemsupdated: function(items) {
- console.log('Item updated');
- },
- onitemsremoved: function(ids) {
- // ...
- }
- };
-
- // Registers to be notified when the calendar changes.
- watcherId = calendar.addChangeListener(watcher);
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var calendar; /* This example assumes calendar is initialized */
+
+var watcher =
+{
+ onitemsadded: function(items)
+ {
+ if (calendar.update)
+ {
+ items[0].location = 'New York';
+ calendar.update(items[0]);
+ }
+ },
+ onitemsupdated: function(items)
+ {
+ console.log('Item updated');
+ },
+ onitemsremoved: function(ids)
+ {
+ /* Do something */
+ }
+};
+
+/* Registers to be notified when the calendar changes */
+watcherId = calendar.addChangeListener(watcher);
+var ev = new tizen.CalendarEvent(
+{
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+});
+</pre>
</div>
</dd>
<dt class="method" id="CalendarChangeCallback::onitemsremoved">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var calendar; // This example assumes calendar is initialized
-
- var watcher = {
- onitemsadded: function(items) {
- if (calendar.remove) {
- calendar.remove(items[0].id);
- }
- },
- onitemsupdated: function(items) {
- // ...
- },
- onitemsremoved: function(ids) {
- console.log('Item removed');
- }
- };
-
- // Registers to be notified when the calendar changes.
- watcherId = calendar.addChangeListener(watcher);
-
- var ev = new tizen.CalendarEvent({description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'});
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var calendar; /* This example assumes calendar is initialized */
+
+var watcher =
+{
+ onitemsadded: function(items)
+ {
+ if (calendar.remove)
+ {
+ calendar.remove(items[0].id);
+ }
+ },
+ onitemsupdated: function(items)
+ {
+ /* Do something */
+ },
+ onitemsremoved: function(ids)
+ {
+ console.log('Item removed');
+ }
+};
+
+/* Registers to be notified when the calendar changes */
+watcherId = calendar.addChangeListener(watcher);
+
+var ev = new tizen.CalendarEvent(
+{
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+});
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines success callback
- function onSuccess(results) {
- console.log(results.length + " call history item(s) found!");
- for (var i=0; i<results.length; i++) {
- console.log(i + ". " + results[i].toString()); // process the CallHistoryEntry
- }
- }
-
- // Defines error callback
- function onError(error) {
- console.log("Query failed" + error.name);
- }
-
- // Defines filter: list CS calls, most recent first
- var filter = new tizen.AttributeFilter("type", "EXACTLY", "TEL");
-
- // Defines sort mode: descending on call start time.
- var sortMode = new tizen.SortMode("startTime", "DESC");
-
- // Makes the query and wires up the callbacks
- tizen.callhistory.find(onSuccess,
- onError,
- filter,
- sortMode);
-
- var numberfilter = new tizen.AttributeFilter(
- "remoteParties.remoteParty",
- "EXACTLY",
- "123456789");
-
- // Creates a composite filter for time constraints
- var y2009Filter = new tizen.AttributeRangeFilter(
- "startTime",
- new Date(2009, 0, 1),
- new Date(2010, 0, 1));
-
- var y2011Filter = new tizen.AttributeRangeFilter(
- "startTime",
- new Date(2011, 0, 1),
- new Date(2012, 0, 1));
-
- var datefilter = new tizen.CompositeFilter("UNION", [y2009Filter, y2011Filter]);
-
- // Creates a filter to find all video calls (including cellular, skype, etc)
- // The filter matches any features from the "features" array exactly
- var tfilter = new tizen.AttributeFilter("features", "EXACTLY", "VIDEOCALL");
-
- // Creates a composite filter
- var ifilter = new tizen.CompositeFilter("INTERSECTION",
- [numberFilter, dateFilter, tfilter]);
-
- // Makes the query and wires up the callbacks; reuse sortMode
- tizen.callhistory.find(onSuccess,
- onError,
- ifilter,
- sortMode);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines success callback */
+function onSuccess(results)
+{
+ console.log(results.length + " call history item(s) found!");
+ for (var i = 0; i < results.length; i++)
+ {
+ console.log(i + ". " + results[i].toString()); /* Process the CallHistoryEntry */
+ }
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("Query failed" + error.name);
+}
+
+/* Defines filter: list CS calls, most recent first */
+var filter = new tizen.AttributeFilter("type", "EXACTLY", "TEL");
+
+/* Defines sort mode: descending on call start time */
+var sortMode = new tizen.SortMode("startTime", "DESC");
+
+/* Makes the query and wires up the callbacks */
+tizen.callhistory.find(onSuccess, onError, filter, sortMode);
+
+var numberfilter = new tizen.AttributeFilter("remoteParties.remoteParty",
+ "EXACTLY", "123456789");
+
+/* Creates a composite filter for time constraints */
+var y2009Filter = new tizen.AttributeRangeFilter("startTime", new Date(2009, 0, 1),
+ new Date(2010, 0, 1));
+
+var y2011Filter = new tizen.AttributeRangeFilter("startTime", new Date(2011, 0, 1),
+ new Date(2012, 0, 1));
+
+var datefilter = new tizen.CompositeFilter("UNION", [y2009Filter, y2011Filter]);
+
+/* Creates a filter to find all video calls (including cellular, skype, etc) */
+/* Filter matches any features from the "features" array exactly */
+var tfilter = new tizen.AttributeFilter("features", "EXACTLY", "VIDEOCALL");
+
+/* Creates a composite filter */
+var ifilter = new tizen.CompositeFilter("INTERSECTION",
+ [numberFilter, dateFilter, tfilter]);
+
+/* Makes the query and wires up the callbacks; reuse sortMode */
+tizen.callhistory.find(onSuccess, onError, ifilter, sortMode);
+</pre>
</div>
</dd>
<dt class="method" id="CallHistory::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines success callback
- function onSuccess(results) {
- if (results.length > 0)
- tizen.callhistory.remove(results[0]);
- }
-
- // Defines error callback
- function onError(error) {
- console.log("Query failed" + error.name);
- }
-
- // Makes the query and wires up the callbacks
- tizen.callhistory.find(onSuccess, onError);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines success callback */
+function onSuccess(results)
+{
+ if (results.length > 0)
+ tizen.callhistory.remove(results[0]);
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("Query failed" + error.name);
+}
+
+/* Makes the query and wires up the callbacks */
+tizen.callhistory.find(onSuccess, onError);
+</pre>
</div>
</dd>
<dt class="method" id="CallHistory::removeBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines success callback
- function onSuccess(results) {
- tizen.callhistory.removeBatch(results);
- }
-
- // Defines error callback
- function onError(error) {
- console.log("Query failed" + error.name);
- }
-
- // Makes the query and wires up the callbacks
- tizen.callhistory.find(onSuccess, onError);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines success callback */
+function onSuccess(results)
+{
+ tizen.callhistory.removeBatch(results);
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("Query failed" + error.name);
+}
+
+/* Makes the query and wires up the callbacks */
+tizen.callhistory.find(onSuccess, onError);
+</pre>
</div>
</dd>
<dt class="method" id="CallHistory::removeAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var onListenerCB = {
- onadded: function(newItems) {
- console.log("New Item added");
- for (var i in newItems) {
- console.log("Item " + i + " startTime: " + newItems[i].startTime);
- }
- },
- onchanged: function(changedItems) {
- console.log("Items changed");
- for (var i in changedItems) {
- console.log("Item " + i + " direction: " + changedItems[i].direction);
- }
- },
- onremoved: function(removedItems) {
- console.log("Items removed");
- for(var i in removedItems) {
- console.log("Item " + i + " : " + removedItems[i]);
- }
- }};
-
- try {
- // Registers a call history callback
- var handle = tizen.callhistory.addChangeListener(onListenerCB);
-
- // Unregisters a previously registered listener
- tizen.callhistory.removeChangeListener(handle);
- } catch (error) {
- console.log("Exception - code: " + error.name + " message: " + error.message);
- }
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var onListenerCB =
+{
+ onadded: function(newItems)
+ {
+ console.log("New Item added");
+ for (var i in newItems)
+ {
+ console.log("Item " + i + " startTime: " + newItems[i].startTime);
+ }
+ },
+ onchanged: function(changedItems)
+ {
+ console.log("Items changed");
+ for (var i in changedItems)
+ {
+ console.log("Item " + i + " direction: " + changedItems[i].direction);
+ }
+ },
+ onremoved: function(removedItems)
+ {
+ console.log("Items removed");
+ for (var i in removedItems)
+ {
+ console.log("Item " + i + ": " + removedItems[i]);
+ }
+ }
+};
+
+try
+{
+ /* Registers a call history callback */
+ var handle = tizen.callhistory.addChangeListener(onListenerCB);
+
+ /* Unregisters a previously registered listener */
+ tizen.callhistory.removeChangeListener(handle);
+}
+catch (error)
+{
+ console.log("Exception - code: " + error.name + " message: " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="CallHistory::removeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback for all the asynchronous calls.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function contactsFoundCB(contacts) {
- // The contact is successfully found.
- // Tries to change the first name.
- contacts[0].name.firstName = 'Jeffrey Ross';
- try {
- addressbook.update(contacts[0]);
- } catch (err) {
- console.log( 'The following error occurred while updating: ' + err.name);
- }
- console.log('First contact was updated');
- }
-
- // Defines the success callback for retrieving all the
- // Address Books.
- function addressBooksCB(addressbooks) {
- if(addressbooks.length > 0) {
- addressbook = addressbooks[0];
- console.log('The addressbook type is ' + addressbook.type +
- ' and name ' + addressbook.name);
-
- var contact = new tizen.Contact(
- {name: new tizen.ContactName({firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']}),
- emails:[new tizen.ContactEmailAddress('user@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]});
-
- addressbook.add(contact);
-
- // The contact has been successfully added.
- // Checks whether the added contact can be retrieved from the address book or not.
- // If the address book is empty, only the item added through saveContact
- // should be returned.
- var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Jeffrey');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- }
- }
-
- // Gets a list of available address books.
- tizen.contact.getAddressBooks(addressBooksCB, errorCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback for all the asynchronous calls */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function contactsFoundCB(contacts)
+{
+ /* Contact is successfully found */
+ /* Tries to change the first name */
+ contacts[0].name.firstName = 'Jeffrey Ross';
+ try
+ {
+ addressbook.update(contacts[0]);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+ console.log('First contact was updated');
+}
+
+/* Defines the success callback for retrieving all the Address Books */
+function addressBooksCB(addressbooks)
+{
+ if (addressbooks.length > 0)
+ {
+ addressbook = addressbooks[0];
+ console.log('The addressbook type is ' + addressbook.type +
+ ' and name ' + addressbook.name);
+
+ var contact = new tizen.Contact(
+ {
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+ });
+
+ addressbook.add(contact);
+
+ /* Contact has been successfully added */
+ /* Checks whether the added contact can be retrieved from the address book */
+ /* If the address book is empty, only the item added through saveContact should be returned */
+ var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Jeffrey');
+ try
+ {
+ addressbook.find(contactsFoundCB, errorCB, filter);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while finding: ' + err.name);
+ }
+ }
+}
+
+/* Gets a list of available address books */
+tizen.contact.getAddressBooks(addressBooksCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::getUnifiedAddressBook">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function contactsFoundCB(contacts) {
- // The contact has been successfully found.
- // Tries to change the first name.
- contacts[0].name.firstName = 'Jeffrey Ross';
- try {
- addressbook.update(contacts[0]);
- console.log('First contact was updated');
- } catch (err) {
- console.log( 'The following error occurred while updating: ' + err.name);
- }
- }
-
- // Gets the unified address book.
- addressbook = tizen.contact.getUnifiedAddressBook();
-
- // Adds a new contact.
- var contact = new tizen.Contact(
- {name: new tizen.ContactName({firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']}),
- emails:[new tizen.ContactEmailAddress('user@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]});
-
- try {
- addressbook.add(contact);
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
-
- // The contact has been successfully added.
- // Tries to check whether the added contact can be retrieved from the address book
- // If the address book is empty, only the item added
- // through saveContact should be returned.
- var filter = new tizen.AttributeFiilter('name.firstName', 'CONTAINS', 'Jeffrey');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function contactsFoundCB(contacts)
+{
+ /* Contact has been successfully found */
+ /* Tries to change the first name */
+ contacts[0].name.firstName = 'Jeffrey Ross';
+ try
+ {
+ addressbook.update(contacts[0]);
+ console.log('First contact was updated');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+}
+
+/* Gets the unified address book */
+addressbook = tizen.contact.getUnifiedAddressBook();
+
+/* Adds a new contact */
+var contact = new tizen.Contact(
+{
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+});
+
+try
+{
+ addressbook.add(contact);
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+
+/* Contact has been successfully added */
+/* Tries to check whether the added contact can be retrieved from the address book */
+/* If the address book is empty, only the item added through saveContact should be returned */
+var filter = new tizen.AttributeFiilter('name.firstName', 'CONTAINS', 'Jeffrey');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::getDefaultAddressBook">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function contactsFoundCB(contacts) {
- // The contact has been successfully found.
- // Tries to change the first name.
- contacts[0].name.firstName = 'Jeffrey Ross';
- try {
- addressbook.update(contacts[0]);
- console.log('First contact was updated');
- } catch (err) {
- console.log( 'The following error occurred while updating: ' + err.name);
- }
- }
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- // Adds a new contact.
- var contact = new tizen.Contact(
- {name: new tizen.ContactName({firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']}),
- emails:[new tizen.ContactEmailAddress('user@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]});
-
- try {
- addressbook.add(contact);
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
-
- // The contact has been successfully added.
- // Checks whether the added contact can be retrieved from the address book.
- // If the address book is empty, only the item added
- // through saveContact should be returned.
- var filter = new tizen.AttributeFiilter('name.firstName', 'CONTAINS', 'Jeffrey');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function contactsFoundCB(contacts)
+{
+ /* Contact has been successfully found */
+ /* Tries to change the first name */
+ contacts[0].name.firstName = 'Jeffrey Ross';
+ try
+ {
+ addressbook.update(contacts[0]);
+ console.log('First contact was updated');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+}
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+/* Adds a new contact */
+var contact = new tizen.Contact(
+{
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+});
+
+try
+{
+ addressbook.add(contact);
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+
+/* Contact has been successfully added */
+/* Checks whether the added contact can be retrieved from the address book */
+/* If the address book is empty, only the item added through saveContact should be returned */
+var filter = new tizen.AttributeFiilter('name.firstName', 'CONTAINS', 'Jeffrey');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::addAddressBook">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- var addressbook = new tizen.AddressBook(
- account.id,
- 'remote addressbook'
- );
- tizen.contact.addAddressBook(addressbook);
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ var addressbook = new tizen.AddressBook(account.id,
+ 'remote addressbook');
+ tizen.contact.addAddressBook(addressbook);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::removeAddressBook">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- var addressbook = new tizen.AddressBook(
- account.id,
- 'remote addressbook'
- );
- tizen.contact.addAddressBook(addressbook);
- tizen.contact.removeAddressBook(addressbook.id);
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ var addressbook = new tizen.AddressBook(account.id,
+ 'remote addressbook');
+ tizen.contact.addAddressBook(addressbook);
+ tizen.contact.removeAddressBook(addressbook.id);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::getAddressBook">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactRef; // ContactRef supposed to be initialized
- try {
- // Retrieves the Contact corresponding to a given ContactRef.
- var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
- var contact = addressBook.get(contactRef.contactId);
- console.log("Successfully resolved contact with id: " + contactRef.contactId);
- } catch(err) {
- console.log("Error: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactRef; /* ContactRef supposed to be initialized */
+try
+{
+ /* Retrieves the Contact corresponding to a given ContactRef */
+ var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
+ var contact = addressBook.get(contactRef.contactId);
+ console.log("Successfully resolved contact with id: " + contactRef.contactId);
+}
+catch (err)
+{
+ console.log("Error: " + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactRef; // ContactRef supposed to be initialized
- try {
- // Retrieves the Person corresponding to a Contact.
- var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
- var contact = addressBook.get(contactRef.contactId);
- var person = tizen.contact.get(contact.personId);
- console.log("Successfully resolved person with id: " + contact.personId);
- } catch(err) {
- console.log("Error: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactRef; /* ContactRef supposed to be initialized */
+try
+{
+ /* Retrieves the Person corresponding to a Contact */
+ var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
+ var contact = addressBook.get(contactRef.contactId);
+ var person = tizen.contact.get(contact.personId);
+ console.log("Successfully resolved person with id: " + contact.personId);
+}
+catch (err)
+{
+ console.log("Error: " + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function personsFoundCB(persons) {
- // The person has been successfully found.
- // Tries to change the isFavorite attribute.
- persons[0].isFavorite = true;
- try {
- tizen.contact.update(persons[0]);
- console.log('First person was updated');
- } catch (err) {
- console.log( 'The following error occurred while updating: ' + err.name);
- }
- }
-
- try {
- tizen.contact.find(personsFoundCB, errorCB);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function personsFoundCB(persons)
+{
+ /* Person has been successfully found */
+ /* Tries to change the isFavorite attribute */
+ persons[0].isFavorite = true;
+ try
+ {
+ tizen.contact.update(persons[0]);
+ console.log('First person was updated');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+}
+
+try
+{
+ tizen.contact.find(personsFoundCB, errorCB);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::updateBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback for all the asynchronous calls.
- function errorCB(err) {
- console.log('The following error occurred: ' + err.name);
- }
-
- function personsUpdatedCB() {
- console.log('Contacts were updated');
- }
-
- function personsFoundCB(persons) {
- // The person has been successfully found.
- for(var i = 0; i < persons.length; i++) {
- persons[i].isFavorite = true;
- }
- try {
- tizen.contact.updateBatch(persons, personsUpdatedCB, errorCB);
- } catch (err) {
- console.log('The following error occurred while updating: ' + err.name);
- }
- }
-
- try {
- tizen.contact.find(personsFoundCB, errorCB);
- } catch (err) {
- console.log('The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback for all the asynchronous calls */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function personsUpdatedCB()
+{
+ console.log('Contacts were updated');
+}
+
+function personsFoundCB(persons)
+{
+ /* Person has been successfully found */
+ for (var i = 0; i < persons.length; i++)
+ {
+ persons[i].isFavorite = true;
+ }
+ try
+ {
+ tizen.contact.updateBatch(persons, personsUpdatedCB, errorCB);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+}
+
+try
+{
+ tizen.contact.find(personsFoundCB, errorCB);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCB(err) {
- console.log('The following error occurred: ' + err.name);
- }
-
- function personsFoundCB(persons) {
- // The person has been successfully found.
- if(persons.length > 0) {
- try {
- tizen.contact.remove(persons[0].id);
- console.log('First person was removed');
- } catch (err) {
- console.log('The following error occurred while removing: ' + err.name);
- }
- } else {
- console.log( 'No persons.');
- }
- }
-
- try {
- tizen.contact.find(personsFoundCB, errorCB);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function personsFoundCB(persons)
+{
+ /* Person has been successfully found */
+ if (persons.length > 0)
+ {
+ try
+ {
+ tizen.contact.remove(persons[0].id);
+ console.log('First person was removed');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('No persons.');
+ }
+}
+
+try
+{
+ tizen.contact.find(personsFoundCB, errorCB);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::removeBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function personsRemovedCB() {
- console.log('Contacts were removed');
- }
-
- function personsFoundCB(persons) {
- // The person has been successfully found.
- if(persons.length > 2) {
- try {
- tizen.contact.removeBatch([persons[0].id, persons[1].id], personsRemovedCB, errorCB);
- } catch (err) {
- console.log( 'The following error occurred while removing: ' + err.name);
- }
- } else {
- console.log( 'Not enough persons.');
- }
- }
-
- try {
- tizen.contact.find(personsFoundCB, errorCB);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function personsRemovedCB()
+{
+ console.log('Contacts were removed');
+}
+
+function personsFoundCB(persons)
+{
+ /* Person has been successfully found */
+ if (persons.length > 2)
+ {
+ try
+ {
+ tizen.contact.removeBatch([persons[0].id, persons[1].id], personsRemovedCB, errorCB);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('Not enough persons.');
+ }
+}
+
+try
+{
+ tizen.contact.find(personsFoundCB, errorCB);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::find">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- // Defines the person search success callback.
- function personsFoundCB(persons) {
- console.log(persons.length + ' results found.');
- }
-
- // Finds all the persons in the contact DB that have the word Ramone in their display name.
- var filter = new tizen.AttributeFilter('displayName', 'CONTAINS', 'Ramone');
-
- // The persons returned by the find() query will be sorted in the ascending order of their display name.
- var sortingMode = new tizen.SortMode('displayName', 'ASC');
- try {
- tizen.contact.find(personsFoundCB, errorCB,
- filter, sortingMode);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+/* Defines the person search success callback */
+function personsFoundCB(persons)
+{
+ console.log(persons.length + ' results found.');
+}
+
+/* Finds all the persons in the contact DB that have the word Ramone in their display name */
+var filter = new tizen.AttributeFilter('displayName', 'CONTAINS', 'Ramone');
+
+/* Persons returned by the find() query will be sorted in the ascending order of their display name */
+var sortingMode = new tizen.SortMode('displayName', 'ASC');
+try
+{
+ tizen.contact.find(personsFoundCB, errorCB, filter, sortingMode);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::findByUsageCount">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- // Defines the person search success callback.
- function personsFoundCB(persons) {
- console.log(persons.length + ' results found.');
- }
-
- // Finds all the persons in the contact DB that have exactly five OUTGOING_CALL
- var filter = new tizen.AttributeFilter('OUTGOING_CALL', 'EXACTLY', 5);
- // Finds all the persons in the contact DB that have OUTGOING_CALL in range <0, 5>
- //var filter = new tizen.AttributeRangeFilter('OUTGOING_CALL', 0, 5);
- try {
- // Finds three most used contacts from contacts found with filter
- tizen.contact.findByUsageCount(filter, personsFoundCB, errorCB, 'DESC', 3, 0);
- // Finds three least used contacts from contacts found with filter
- //tizen.contact.findByUsageCount(filter, personsFoundCB, errorCB, 'ASC', 3, 0);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+/* Defines the person search success callback */
+function personsFoundCB(persons)
+{
+ console.log(persons.length + ' results found.');
+}
+
+/* Finds all the persons in the contact DB that have exactly five OUTGOING_CALL */
+var filter = new tizen.AttributeFilter('OUTGOING_CALL', 'EXACTLY', 5);
+/* Finds all the persons in the contact DB that have OUTGOING_CALL in range <0, 5> */
+/* var filter = new tizen.AttributeRangeFilter('OUTGOING_CALL', 0, 5); */
+try
+{
+ /* Finds three most used contacts from contacts found with filter */
+ tizen.contact.findByUsageCount(filter, personsFoundCB, errorCB, 'DESC', 3, 0);
+ /* Finds three least used contacts from contacts found with filter */
+ /* tizen.contact.findByUsageCount(filter, personsFoundCB, errorCB, 'ASC', 3, 0); */
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> 3 results found.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
-
- var watcher = {
- onpersonsadded: function(persons) {
- console.log(persons.length + ' persons were added');
- },
- onpersonsupdated: function(persons) {
- console.log(persons.length + ' persons were updated');
- },
- onpersonsremoved: function(ids) {
- console.log(ids.length + ' persons were deleted');
- }
- };
-
- // Registers to be notified when the person changes.
- watcherId = tizen.contact.addChangeListener(watcher);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+
+var watcher =
+{
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + ' persons were added');
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + ' persons were updated');
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + ' persons were deleted');
+ }
+};
+
+/* Registers to be notified when the person changes */
+watcherId = tizen.contact.addChangeListener(watcher);
+</pre>
</div>
</dd>
<dt class="method" id="ContactManager::removeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
-
- // Receives person changes.
- var watcher = {
- onpersonsadded: function(persons) {
- console.log(persons.length + ' persons were added');
- },
- onpersonsupdated: function(persons) {
- console.log(persons.length + ' persons were updated');
- },
- onpersonsremoved: function(ids) {
- console.log(ids.length + ' persons were removed');
- }
- };
-
- // Cancels the watch operation.
- function cancelWatch() {
- tizen.contact.removeChangeListener(watcherId);
- }
-
- // Registers to be notified of person changes.
- watcherId = tizen.contact.addChangeListener(watcher);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+
+/* Receives person changes */
+var watcher =
+{
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + ' persons were added');
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + ' persons were updated');
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + ' persons were removed');
+ }
+};
+
+/* Cancels the watch operation */
+function cancelWatch()
+{
+ tizen.contact.removeChangeListener(watcherId);
+}
+
+/* Registers to be notified of person changes */
+watcherId = tizen.contact.addChangeListener(watcher);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appId = tizen.application.getCurrentApplication().appInfo.id;
- tizen.account.getAccounts(function(accounts) {
- var account = accounts[0];
- if(account) {
- var addressbook = new tizen.AddressBook(
- account.id,
- 'remote addressbook'
- );
-
- // 'addressbook' variable is not available until it is inserted into database.
- tizen.contact.addAddressBook(addressbook);
- }
- }, function(e) {
- console.log('Error: ' + e.message);
- }, appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+tizen.account.getAccounts(function(accounts)
+{
+ var account = accounts[0];
+ if (account)
+ {
+ var addressbook = new tizen.AddressBook(account.id,
+ 'remote addressbook');
+
+ /* 'addressbook' variable is not available until it is inserted into database */
+ tizen.contact.addAddressBook(addressbook);
+ }
+}, function(e)
+{
+ console.log('Error: ' + e.message);
+}, appId);
+</pre>
</div>
<div class="constructors">
<h4 id="AddressBook::constructor">Constructors</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactRef; // ContactRef supposed to be initialized
- try {
- // Retrieves the Contact corresponding to a given ContactRef.
- var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
- var contact = addressBook.get(contactRef.contactId);
- console.log("Successfully resolved contact with id: " + contactRef.contactId);
- } catch(err) {
- console.log("Error: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactRef; /* ContactRef supposed to be initialized */
+try
+{
+ /* Retrieves the Contact corresponding to a given ContactRef */
+ var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
+ var contact = addressBook.get(contactRef.contactId);
+ console.log("Successfully resolved contact with id: " + contactRef.contactId);
+}
+catch (err)
+{
+ console.log("Error: " + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::add">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- try {
- var contact = new tizen.Contact({name: new tizen.ContactName({firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']}),
- emails:[new tizen.ContactEmailAddress('user@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]});
- addressbook.add(contact);
- console.log('Contact added with id ' + contact.id);
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+try
+{
+ var contact = new tizen.Contact(
+ {
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+ });
+ addressbook.add(contact);
+ console.log('Contact added with id ' + contact.id);
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::addBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- // Defines the add contact success callback
- function contactsAddedCB(contacts) {
- console.log( contacts.length + ' contact(s) were successfully added to an Address Book' );
- };
-
- // Gets the default address book
- addressbook = tizen.contact.getDefaultAddressBook();
-
- var c1 = new tizen.Contact({name: new tizen.ContactName({firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']}),
- emails:[new tizen.ContactEmailAddress('user1@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]});
-
- var c2 = new tizen.Contact({name: new tizen.ContactName({firstName:'Elton',
- lastName:'John',
- nicknames:['El']}),
- emails:[new tizen.ContactEmailAddress('user2@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('987654321')]});
-
- try {
- addressbook.addBatch([c1, c2], contactsAddedCB, errorCB);
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+/* Defines the add contact success callback */
+function contactsAddedCB(contacts)
+{
+ console.log(contacts.length + ' contact(s) were successfully added to an Address Book');
+};
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+var c1 = new tizen.Contact(
+{
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user1@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+});
+
+var c2 = new tizen.Contact(
+{
+ name: new tizen.ContactName(
+ {
+ firstName:'Elton',
+ lastName:'John',
+ nicknames:['El']
+ }),
+ emails:[new tizen.ContactEmailAddress('user2@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('987654321')]
+});
+
+try
+{
+ addressbook.addBatch([c1, c2], contactsAddedCB, errorCB);
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function contactsFoundCB(contacts) {
- // The contact has been successfully found.
- // Tries to change the first name.
- contacts[0].name.firstName = 'Christopher';
- try {
- addressbook.update(contacts[0]);
- console.log('First contact was updated');
- } catch (err) {
- console.log( 'The following error occurred while updating: ' + err.name);
- }
- }
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function contactsFoundCB(contacts)
+{
+ /* Contact has been successfully found */
+ /* Tries to change the first name */
+ contacts[0].name.firstName = 'Christopher';
+ try
+ {
+ addressbook.update(contacts[0]);
+ console.log('First contact was updated');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+}
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::updateBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback for all the asynchronous calls.
- function errorCB(err) {
- console.log('The following error occurred: ' + err.name);
- }
-
- function contactsUpdatedCB() {
- console.log('Contacts were updated');
- }
-
- function contactsFoundCB(contacts) {
- // The contact has been successfully found.
- for(var i = 0; i < contacts.length; i++) {
- contacts[i].name.firstName = 'Christopher';
- }
- try {
- addressbook.updateBatch(contacts, contactsUpdatedCB, errorCB);
- } catch (err) {
- console.log('The following error occurred while updating: ' + err.name);
- }
- }
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log('The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback for all the asynchronous calls */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function contactsUpdatedCB()
+{
+ console.log('Contacts were updated');
+}
+
+function contactsFoundCB(contacts)
+{
+ /* Contact has been successfully found */
+ for (var i = 0; i < contacts.length; i++)
+ {
+ contacts[i].name.firstName = 'Christopher';
+ }
+ try
+ {
+ addressbook.updateBatch(contacts, contactsUpdatedCB, errorCB);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+}
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback.
- function errorCB(err) {
- console.log('The following error occurred: ' + err.name);
- }
-
- function contactsFoundCB(contacts) {
- // The contact has been successfully found.
- if(contacts.length > 0) {
- try {
- addressbook.remove(contacts[0].id);
- console.log('First contact was removed');
- } catch (err) {
- console.log('The following error occurred while removing: ' + err.name);
- }
- } else {
- console.log( 'No contacts.');
- }
- }
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function contactsFoundCB(contacts)
+{
+ /* Contact has been successfully found */
+ if (contacts.length > 0)
+ {
+ try
+ {
+ addressbook.remove(contacts[0].id);
+ console.log('First contact was removed');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('No contacts.');
+ }
+}
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::removeBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function contactsRemovedCB() {
- console.log('Contacts were removed');
- }
-
- function contactsFoundCB(contacts) {
- // The contact has been successfully found.
- if(contacts.length > 2) {
- try {
- addressbook.removeBatch([contacts[0].id, contacts[1].id], contactsRemovedCB, errorCB);
- } catch (err) {
- console.log( 'The following error occurred while removing: ' + err.name);
- }
- } else {
- console.log( 'Not enough contacts.');
- }
- }
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function contactsRemovedCB()
+{
+ console.log('Contacts were removed');
+}
+
+function contactsFoundCB(contacts)
+{
+ /* Contact has been successfully found */
+ if (contacts.length > 2)
+ {
+ try
+ {
+ addressbook.removeBatch([contacts[0].id, contacts[1].id], contactsRemovedCB, errorCB);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('Not enough contacts.');
+ }
+}
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::find">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- // Defines the contact search success callback.
- function contactsFoundCB(contacts) {
- console.log(contacts.length + ' results found.');
- }
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- // Finds all contacts in the address book that have "Ramone" in the nick name.
- var filter = new tizen.AttributeFilter('name.nicknames', 'CONTAINS', 'Ramone');
-
- // The contacts returned by the find() query will be sorted by
- // ascending last name.
- var sortingMode = new tizen.SortMode('name.lastName', 'ASC');
- try {
- addressbook.find(contactsFoundCB, errorCB,
- filter, sortingModes);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+/* Defines the contact search success callback */
+function contactsFoundCB(contacts)
+{
+ console.log(contacts.length + ' results found.');
+}
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+/* Finds all contacts in the address book that have "Ramone" in the nick name */
+var filter = new tizen.AttributeFilter('name.nicknames', 'CONTAINS', 'Ramone');
+
+/* Contacts returned by the find() query will be sorted by ascending last name */
+var sortingMode = new tizen.SortMode('name.lastName', 'ASC');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter, sortingModes);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::addChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var addressbook; // This example assumes addressbook is initialized
-
- var watcher = {
- oncontactsadded: function(contacts) {
- console.log(contacts.length + ' contacts were added');
- },
- oncontactsupdated: function(contacts) {
- console.log(contacts.length + ' contacts were updated');
- },
- oncontactsremoved: function(ids) {
- console.log(ids.length + ' contacts were deleted');
- }
- };
-
- // Registers to be notified when the address book changes.
- watcherId = addressbook.addChangeListener(watcher);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var addressbook; /* This example assumes addressbook is initialized */
+
+var watcher =
+{
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + ' contacts were added');
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + ' contacts were updated');
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + ' contacts were deleted');
+ }
+};
+
+/* Registers to be notified when the address book changes */
+watcherId = addressbook.addChangeListener(watcher);
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::removeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var addressbook; // This example assumes addressbook is initialized
-
- // Receives address book changes.
- var watcher = {
- oncontactsadded: function(contacts) {
- console.log(contacts.length + ' contacts were added');
- },
- oncontactsupdated: function(contacts) {
- console.log(contacts.length + ' contacts were updated');
- },
- oncontactsremoved: function(ids) {
- console.log(ids.length + ' contacts were removed');
- }
- };
-
- // Cancels the watch operation.
- function cancelWatch() {
- addressbook.removeChangeListener(watcherId);
- }
-
- // Registers to be notified when the address book changes.
- watcherId = addressbook.addChangeListener(watcher);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var addressbook; /* This example assumes addressbook is initialized */
+
+/* Receives address book changes */
+var watcher =
+{
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + ' contacts were added');
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + ' contacts were updated');
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + ' contacts were removed');
+ }
+};
+
+/* Cancels the watch operation */
+function cancelWatch()
+{
+ addressbook.removeChangeListener(watcherId);
+}
+
+/* Registers to be notified when the address book changes */
+watcherId = addressbook.addChangeListener(watcher);
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::getGroup">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Retrieves the Person corresponding to a Contact.
- var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
- var contact = addressBook.get(contactRef.contactId);
- var group = addressBook.getGroup(contact.groupIds[0].id);
- console.log("Successfully resolved group with id: " + contact.groupIds[0].id);
- } catch(err) {
- console.log("Error: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Retrieves the Person corresponding to a Contact */
+ var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
+ var contact = addressBook.get(contactRef.contactId);
+ var group = addressBook.getGroup(contact.groupIds[0].id);
+ console.log("Successfully resolved group with id: " + contact.groupIds[0].id);
+}
+catch (err)
+{
+ console.log("Error: " + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::addGroup">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Gets the address book.
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- try {
- var group = new tizen.ContactGroup('Company');
- addressbook.addGroup(group);
- console.log('Group added with id ' + group.id);
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Gets the address book */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+try
+{
+ var group = new tizen.ContactGroup('Company');
+ addressbook.addGroup(group);
+ console.log('Group added with id ' + group.id);
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::updateGroup">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Gets the address book.
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- try {
- groups = addressbook.getGroups();
- groups[0].name = 'Friends';
- addressbook.updateGroup(groups[0]);
- console.log('First group was updated');
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Gets the address book */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+try
+{
+ groups = addressbook.getGroups();
+ groups[0].name = 'Friends';
+ addressbook.updateGroup(groups[0]);
+ console.log('First group was updated');
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::removeGroup">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Gets the default address book.
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- try {
- groups = addressbook.getGroups();
- addressbook.removeGroup(groups[0].id);
- console.log('First group was removed');
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Gets the default address book */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+try
+{
+ groups = addressbook.getGroups();
+ addressbook.removeGroup(groups[0].id);
+ console.log('First group was removed');
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBook::getGroups">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Gets the default address book.
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- try {
- groups = addressbook.getGroups();
- console.log('Number of groups is ' + groups.length);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Gets the default address book */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+try
+{
+ groups = addressbook.getGroups();
+ console.log('Number of groups is ' + groups.length);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback for all the asynchronous calls.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function personsFoundCB(persons) {
- // The persons have been successfully found.
- try {
- persons[0].link(persons[1].id);
- console.log('Second person was merged to the first person.');
- } catch (err) {
- console.log( 'The following error occurred while updating: ' + err.name);
- }
- }
-
- try {
- tizen.contact.find(personsFoundCB, errorCB);
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback for all the asynchronous calls */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function personsFoundCB(persons)
+{
+ /* Persons have been successfully found */
+ try
+ {
+ persons[0].link(persons[1].id);
+ console.log('Second person was merged to the first person.');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+}
+
+try
+{
+ tizen.contact.find(personsFoundCB, errorCB);
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Person::unlink">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myPersonId = '1'; //ID of modified
-
- var addressbook; // Default addressbook
- var person; // Existing person obtained from addressbook
- var newPerson; // New person, which will be created during unlink
-
- // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- // Defines the contact search success callback.
- function contactsFoundCB(contacts) {
- if (contacts.length > 1) {
- try {
- // Unlinks the first contact.
- newPerson = person.unlink(contacts[0].id);
- } catch (err) {
- console.log( 'The following error occurred while unlink: ' + err.name);
- }
- } else {
- console.log( 'Not enough contacts ');
- }
- }
-
- try {
- // Gets the person.
- person = tizen.contact.get(myPersonId);
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- // Finds all the contacts in the default address book with personId
- // as exactly myPersonId.
- var filter = new tizen.AttributeFilter('personId', 'EXACTLY', myPersonId);
-
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log( 'The following error occurred while processing: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myPersonId = '1'; /* ID of modified */
+
+var addressbook; /* Default addressbook */
+var person; /* Existing person obtained from addressbook */
+var newPerson; /* New person, which will be created during unlink */
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+/* Defines the contact search success callback */
+function contactsFoundCB(contacts)
+{
+ if (contacts.length > 1)
+ {
+ try
+ {
+ /* Unlinks the first contact */
+ newPerson = person.unlink(contacts[0].id);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while unlink: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('Not enough contacts ');
+ }
+}
+
+try
+{
+ /* Gets the person */
+ person = tizen.contact.get(myPersonId);
+
+ /* Gets the default address book */
+ addressbook = tizen.contact.getDefaultAddressBook();
+
+ /* Finds all the contacts in the default address book with personId as exactly myPersonId */
+ var filter = new tizen.AttributeFilter('personId', 'EXACTLY', myPersonId);
+
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (err)
+{
+ console.log('The following error occurred while processing: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Person::getUsageCount">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myPersonId = '1'; // ID of person
- var person = tizen.contact.get(myPersonId);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myPersonId = '1'; /* ID of person */
+var person = tizen.contact.get(myPersonId);
- var outCalls = person.getUsageCount(OUTGOING_CALL);
- var allUsages = person.getUsageCount();
+var outCalls = person.getUsageCount(OUTGOING_CALL);
+var allUsages = person.getUsageCount();
- console.log('Number of outgoing calls: ' + outCalls);
- console.log('Number of all usages: ' + allUsages);
- </pre>
+console.log('Number of outgoing calls: ' + outCalls);
+console.log('Number of all usages: ' + allUsages);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Number of outgoing calls: 12
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myPersonId = '1'; // ID of person
- var person = tizen.contact.get(myPersonId);
- console.log('Usage count before reset: ' + person.getUsageCount());
- person.resetUsageCount();
- console.log('Usage count after reset: ' + person.getUsageCount());
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myPersonId = '1'; /* ID of person */
+var person = tizen.contact.get(myPersonId);
+console.log('Usage count before reset: ' + person.getUsageCount());
+person.resetUsageCount();
+console.log('Usage count after reset: ' + person.getUsageCount());
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Usage count before reset: 2
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the default address book.
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- var contact = null;
-
- try {
- contact = new tizen.Contact(
- "BEGIN:VCARD\n"+
- "VERSION:3.0\n"+
- "N:Gump;Forrest\n"+
- "FN:Forrest Gump\n"+
- "ORG:Bubba Gump Shrimp Co.\n"+
- "TITLE:Shrimp Man\n"+
- "TEL;WORK:(111) 555-1212\n"+
- "TEL;HOME:(404) 555-1212\n"+
- "EMAIL;WORK;PREF:forrestgump@example.com\n"+
- "END:VCARD");
- } catch (err) {
- console.log( 'The following error occurred while converting: ' + err.name);
- }
-
- try {
- if (contact) {
- addressbook.add(contact);
- console.log('Contact was added with ID ' + contact.id);
- }
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the default address book */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+var contact = null;
+
+try
+{
+ contact = new tizen.Contact("BEGIN:VCARD\n"+
+ "VERSION:3.0\n"+
+ "N:Gump;Forrest\n"+
+ "FN:Forrest Gump\n"+
+ "ORG:Bubba Gump Shrimp Co.\n"+
+ "TITLE:Shrimp Man\n"+
+ "TEL;WORK:(111) 555-1212\n"+
+ "TEL;HOME:(404) 555-1212\n"+
+ "EMAIL;WORK;PREF:forrestgump@example.com\n"+
+ "END:VCARD");
+}
+catch (err)
+{
+ console.log('The following error occurred while converting: ' + err.name);
+}
+
+try
+{
+ if (contact)
+ {
+ addressbook.add(contact);
+ console.log('Contact was added with ID ' + contact.id);
+ }
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the default address book.
- var addressbook = tizen.contact.getDefaultAddressBook();
- var contact = null;
-
- var name = new tizen.ContactName({
- firstName: "Forrest",
- lastName: "Gump"
- });
- var addresses = [ new tizen.ContactAddress({
- city: "New York",
- streetAddress: "46th St.",
- isDefault: true }) ];
- var phoneNumbers = [ new tizen.ContactPhoneNumber("(111) 555-1212"),
- new tizen.ContactPhoneNumber("(111) 555-1213") ];
-
- try {
- contact = new tizen.Contact({
- name: name,
- addresses: addresses,
- phoneNumbers: phoneNumbers
- });
- } catch (err) {
- console.log( 'The following error occurred while creating contact: ' + err.name);
- }
-
- try {
- if (contact) {
- addressbook.add(contact);
- console.log('Contact was added with ID ' + contact.id);
- }
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the default address book */
+var addressbook = tizen.contact.getDefaultAddressBook();
+var contact = null;
+
+var name = new tizen.ContactName(
+{
+ firstName: "Forrest",
+ lastName: "Gump"
+});
+var addresses = [new tizen.ContactAddress(
+{
+ city: "New York",
+ streetAddress: "46th St.",
+ isDefault: true
+})];
+var phoneNumbers = [new tizen.ContactPhoneNumber("(111) 555-1212"),
+ new tizen.ContactPhoneNumber("(111) 555-1213")];
+
+try
+{
+ contact = new tizen.Contact(
+ {
+ name: name,
+ addresses: addresses,
+ phoneNumbers: phoneNumbers
+ });
+}
+catch (err)
+{
+ console.log('The following error occurred while creating contact: ' + err.name);
+}
+
+try
+{
+ if (contact)
+ {
+ addressbook.add(contact);
+ console.log('Contact was added with ID ' + contact.id);
+ }
+}
+catch (err)
+{
+ console.log('The following error occurred while adding: ' + err.name);
+}
+</pre>
</div>
<div class="constructors">
<h4 id="Contact::constructor">Constructors</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> if (contact.isFavorite) {
- // ...
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+if (contact.isFavorite)
+{
+ /* Do something */
+}
+</pre>
</div>
</li>
<li class="attribute" id="Contact::name">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var contactAddr = new tizen.ContactAddress({streetAddress:'Gran Via, 32',
- postalCode:'50013',
- city:'Zaragoza',
- country:'ES'});
- contactInit.addresses = [contactAddr];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var contactAddr = new tizen.ContactAddress(
+{
+ streetAddress:'Gran Via, 32',
+ postalCode:'50013',
+ city:'Zaragoza',
+ country:'ES'
+});
+contactInit.addresses = [contactAddr];
+</pre>
</div>
</li>
<li class="attribute" id="Contact::photoURI">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- tizen.filesystem.resolve('images/mypicture.jpg', function(imageFile) {
- contactInit.photoURI = imageFile.toURI();
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+tizen.filesystem.resolve('images/mypicture.jpg', function(imageFile)
+{
+ contactInit.photoURI = imageFile.toURI();
+});
+</pre>
</div>
</li>
<li class="attribute" id="Contact::phoneNumbers">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var phoneNumber = new tizen.ContactPhoneNumber('123456789');
- contactInit.phoneNumbers = [phoneNumber];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var phoneNumber = new tizen.ContactPhoneNumber('123456789');
+contactInit.phoneNumbers = [phoneNumber];
+</pre>
</div>
</li>
<li class="attribute" id="Contact::emails">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var email = new tizen.ContactEmailAddress('deedee@ramones.com');
- contactInit.emails = [email];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var email = new tizen.ContactEmailAddress('deedee@ramones.com');
+contactInit.emails = [email];
+</pre>
</div>
</li>
<li class="attribute" id="Contact::messengers">
2.3
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var messenger = new tizen.ContactInstantMessenger('user@example.com');
- contactInit.messengers = [messenger];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var messenger = new tizen.ContactInstantMessenger('user@example.com');
+contactInit.messengers = [messenger];
+</pre>
</div>
</li>
<li class="attribute" id="Contact::relationships">
2.3
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- // Contact is brother of 'Anna'.
- var relationship = new tizen.ContactRelationship('Anna', "BROTHER");
- contactInit.relationships = [relationship];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+/* Contact is brother of 'Anna' */
+var relationship = new tizen.ContactRelationship('Anna', "BROTHER");
+contactInit.relationships = [relationship];
+</pre>
</div>
</li>
<li class="attribute" id="Contact::extensions">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var extension = new tizen.ContactExtension({ data1: 20, data2: 'Place of birth: ElblÄ…g' });
- contactInit.extensions = [extension];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var extension = new tizen.ContactExtension({data1: 20, data2: 'Place of birth: ElblÄ…g'});
+contactInit.extensions = [extension];
+</pre>
</div>
</li>
<li class="attribute" id="Contact::birthday">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- contactInit.birthday = new Date(1996, 4, 15);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+contactInit.birthday = new Date(1996, 4, 15);
+</pre>
</div>
</li>
<li class="attribute" id="Contact::anniversaries">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage');
- contactInit.anniversaries = [marriage_anniv];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage');
+contactInit.anniversaries = [marriage_anniv];
+</pre>
</div>
</li>
<li class="attribute" id="Contact::organizations">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook;
-
- // Defines the error callback.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- // Defines the contact find success callback.
- function contactsFoundCB(contacts) {
- try {
- // Converts the first contact to vCard 3.0 format.
- var vcard = contacts[0].convertToString("VCARD_30");
- console.log('textual representation of the contact is: ' + vcard);
- } catch (err) {
- console.log( 'The following error occurred while converting: ' + err.name);
- }
- }
-
- // Gets the default address book.
- addressbook = tizen.contact.getDefaultAddressBook();
-
- // Finds all contacts in the address book whose first name contains the string 'Chris'.
- var filter = new tizen.AttributeFilter('firstName', 'CONTAINS', 'Chris');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (err) {
- console.log( 'The following error occurred while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook;
+
+/* Defines the error callback */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+/* Defines the contact find success callback */
+function contactsFoundCB(contacts)
+{
+ try
+ {
+ /* Converts the first contact to vCard 3.0 format */
+ var vcard = contacts[0].convertToString("VCARD_30");
+ console.log('textual representation of the contact is: ' + vcard);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while converting: ' + err.name);
+ }
+}
+
+/* Gets the default address book */
+addressbook = tizen.contact.getDefaultAddressBook();
+
+/* Finds all contacts in the address book whose first name contains the string 'Chris' */
+var filter = new tizen.AttributeFilter('firstName', 'CONTAINS', 'Chris');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (err)
+{
+ console.log('The following error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Contact::clone">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the default address book.
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- var bob = new tizen.Contact();
- bob.name = new tizen.ContactName({firstName:'Bob',
- lastName:'Smith'});
- addressbook.add(bob);
- var alice = bob.clone();
- contact.name.firstName = "Alice"; // Bob's wife
- addressbook.add(alice);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the default address book */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+var bob = new tizen.Contact();
+bob.name = new tizen.ContactName({firstName:'Bob', lastName:'Smith'});
+addressbook.add(bob);
+var alice = bob.clone();
+contact.name.firstName = "Alice"; /* Bob's wife */
+addressbook.add(alice);
+</pre>
</div>
</dd>
</dl>
<dl>
<pre class="webidl prettyprint">ContactRef(<a href="#AddressBookId">AddressBookId</a> addressBookId, <a href="#ContactId">ContactId</a> contactId);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the default address book.
- var addressbook = tizen.contact.getDefaultAddressBook();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the default address book */
+var addressbook = tizen.contact.getDefaultAddressBook();
- // Creates a new contact:
- var eve = new tizen.Contact();
- eve.name = new tizen.ContactName({firstName:'Eve', lastName:'Green'});
- addressbook.add(eve);
+/* Creates a new contact */
+var eve = new tizen.Contact();
+eve.name = new tizen.ContactName({firstName:'Eve', lastName:'Green'});
+addressbook.add(eve);
- // Creates a reference to this contact:
- var refToEve = new tizen.ContactRef(addressbook.id, eve.id);
- </pre>
+/* Creates a reference to this contact */
+var refToEve = new tizen.ContactRef(addressbook.id, eve.id);
+</pre>
</div>
</dl>
</div>
<dl>
<pre class="webidl prettyprint">ContactName(optional <a href="#ContactNameInit">ContactNameInit</a>? nameInitDict);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myContactName = new tizen.ContactName(
- {prefix : "Mr.", firstName : "John", lastName : "Doe"});
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myContactName = new tizen.ContactName(
+{
+ prefix: "Mr.", firstName: "John", lastName: "Doe"
+});
+</pre>
</div>
</dl>
</div>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> contact.name.prefix = "Dr.";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+contact.name.prefix = "Dr.";
+</pre>
</div>
</li>
<li class="attribute" id="ContactName::suffix">
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> contact.name.suffix = "Jr.";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+contact.name.suffix = "Jr.";
+</pre>
</div>
</li>
<li class="attribute" id="ContactName::firstName">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> contact.name.firstName = 'Douglas';
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+contact.name.firstName = 'Douglas';
+</pre>
</div>
</li>
<li class="attribute" id="ContactName::middleName">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> contact.name.middleName = 'Glenn';
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+contact.name.middleName = 'Glenn';
+</pre>
</div>
</li>
<li class="attribute" id="ContactName::lastName">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> contact.name.lastName = 'Colvin';
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+contact.name.lastName = 'Colvin';
+</pre>
</div>
</li>
<li class="attribute" id="ContactName::nicknames">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> contact.name.nickNames = ['Dee Dee'];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+contact.name.nickNames = ['Dee Dee'];
+</pre>
</div>
</li>
<li class="attribute" id="ContactName::phoneticFirstName">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var organization = new tizen.ContactOrganization({name: "Nice Company", role: "SW Engineer"});
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var organization = new tizen.ContactOrganization({name: "Nice Company", role: "SW Engineer"});
+</pre>
</div>
<div class="constructors">
<h4 id="ContactOrganization::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {}
- var blog = new tizen.ContactWebSite('http://www.domain.com', 'BLOG');
- contactInit.urls = [blog];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {}
+var blog = new tizen.ContactWebSite('http://www.domain.com', 'BLOG');
+contactInit.urls = [blog];
+</pre>
</div>
<div class="constructors">
<h4 id="ContactWebSite::constructor">Constructors</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {}
- var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage');
- contactInit.anniversaries = [marriage_anniv];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {}
+var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage');
+contactInit.anniversaries = [marriage_anniv];
+</pre>
</div>
<div class="constructors">
<h4 id="ContactAnniversary::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var contactAddress = new tizen.ContactAddress({streetAddress:'Gran Via, 32',
- postalCode:'50013', city:'Zaragoza',
- country:'ES', types:['WORK']});
- contactInit.contactAddress = [contactAddress];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var contactAddress = new tizen.ContactAddress(
+{
+ streetAddress:'Gran Via, 32',
+ postalCode:'50013', city:'Zaragoza',
+ country:'ES', types:['WORK']
+});
+contactInit.contactAddress = [contactAddress];
+</pre>
</div>
<div class="constructors">
<h4 id="ContactAddress::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var phoneNumber = new tizen.ContactPhoneNumber('123456789', ['WORK','VOICE'], true);
- contactInit.phoneNumbers = [phoneNumber];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var phoneNumber = new tizen.ContactPhoneNumber('123456789', ['WORK','VOICE'], true);
+contactInit.phoneNumbers = [phoneNumber];
+</pre>
</div>
<div class="constructors">
<h4 id="ContactPhoneNumber::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var email = new tizen.ContactEmailAddress('user@domain.com', ['WORK']);
- contactInit.emails = [email];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var email = new tizen.ContactEmailAddress('user@domain.com', ['WORK']);
+contactInit.emails = [email];
+</pre>
</div>
<div class="constructors">
<h4 id="ContactEmailAddress::constructor">Constructors</h4>
2.3
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- var messenger = new tizen.ContactInstantMessenger('user@domain.com', 'GOOGLE');
- contactInit.messengers = [messenger];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+var messenger = new tizen.ContactInstantMessenger('user@domain.com', 'GOOGLE');
+contactInit.messengers = [messenger];
+</pre>
</div>
<div class="constructors">
<h4 id="ContactInstantMessenger::constructor">Constructors</h4>
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var addressbook = null;
- var group = null;
- var ringtones = null;
-
- // Defines the error callback for all the asynchronous calls.
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- // Defines the success callback for retrieving all the
- // Address Books.
- function addressBooksCB(addressbooks) {
- addressbook = addressbooks[0];
- try {
- group = new tizen.ContactGroup('Family', ringtones.resolve('ring.mp3').toURI());
- } catch (err) {
- console.log( 'The following error occurred while converting: ' + err.name);
- }
-
- try {
- if (group) {
- addressbook.addGroup(group);
- console.log('Group was added with ID ' + group.id);
- }
- } catch (err) {
- console.log( 'The following error occurred while adding: ' + err.name);
- }
- }
-
- tizen.filesystem.resolve("ringtones", function(dir) {
- ringtones = dir;
- tizen.contact.getAddressBooks(addressBooksCB, errorCB);
- });
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var addressbook = null;
+var group = null;
+var ringtones = null;
+
+/* Defines the error callback for all the asynchronous calls */
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+/* Defines the success callback for retrieving all the Address Books */
+function addressBooksCB(addressbooks)
+{
+ addressbook = addressbooks[0];
+ try
+ {
+ group = new tizen.ContactGroup('Family', ringtones.resolve('ring.mp3').toURI());
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while converting: ' + err.name);
+ }
+
+ try
+ {
+ if (group)
+ {
+ addressbook.addGroup(group);
+ console.log('Group was added with ID ' + group.id);
+ }
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while adding: ' + err.name);
+ }
+}
+
+tizen.filesystem.resolve("ringtones", function(dir)
+{
+ ringtones = dir;
+ tizen.contact.getAddressBooks(addressBooksCB, errorCB);
+});
+</pre>
</div>
<div class="constructors">
<h4 id="ContactGroup::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var contactInit = {};
- // Contact is brother of 'Anna'
- var relationship = new tizen.ContactRelationship('Anna', 'BROTHER');
- contactInit.relationships = [relationship];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var contactInit = {};
+/* Contact is brother of 'Anna' */
+var relationship = new tizen.ContactRelationship('Anna', 'BROTHER');
+contactInit.relationships = [relationship];
+</pre>
</div>
<div class="constructors">
<h4 id="ContactRelationship::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var name = new tizen.ContactName({ firstName: 'Anna' });
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var name = new tizen.ContactName({firstName: 'Anna'});
- var contact_extension1 = new tizen.ContactExtension({ data1: 20, data2: 'Place of birth: ElblÄ…g' });
- var contact_extension2 = new tizen.ContactExtension({ data3: 'Favourite color: green' });
- var contact1 = new tizen.Contact({
- name: name,
- extensions: [ contact_extension1, contact_extension2 ]
- });
+var contact_extension1 = new tizen.ContactExtension({data1: 20, data2: 'Place of birth: ElblÄ…g'});
+var contact_extension2 = new tizen.ContactExtension({data3: 'Favourite color: green'});
+var contact1 = new tizen.Contact(
+{
+ name: name,
+ extensions: [contact_extension1, contact_extension2]
+});
- console.log(contact1.extensions[1].data3); // It shows: 'Favourite color: green'
- </pre>
+console.log(contact1.extensions[1].data3); /* It shows: 'Favourite color: green' */
+</pre>
</div>
<div class="constructors">
<h4 id="ContactExtension::constructor">Constructors</h4>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(err) {
- console.log("The following error occurred " + err.name);
- }
-
- function onsuccess(persons) {
- var p;
-
- // log each found person's name to the console:
- for (p = 0; p < persons.length; p += 1) {
- console.log("Name: " + persons[p].displayName);
- }
- }
-
- try {
- tizen.contact.find(onsuccess, onerror);
- } catch (err) {
- console.log("The following error occurred while finding: " + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(err)
+{
+ console.log("The following error occurred " + err.name);
+}
+
+function onsuccess(persons)
+{
+ var p;
+
+ /* Log each found person's name to the console */
+ for (p = 0; p < persons.length; p += 1)
+ {
+ console.log("Name: " + persons[p].displayName);
+ }
+}
+
+try
+{
+ tizen.contact.find(onsuccess, onerror);
+}
+catch (err)
+{
+ console.log("The following error occurred while finding: " + err.name);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCB(err) {
- console.log("An error occurred: " + err.name);
- }
-
- // A callback invoked on successful retrieval of all the Address Books.
- function addressBooksCB(addressBooks) {
- console.log(addressBooks.length + " address books available.");
- }
-
- // Gets a list of available address books.
- tizen.contact.getAddressBooks(addressBooksCB, errorCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCB(err)
+{
+ console.log("An error occurred: " + err.name);
+}
+
+/* Callback invoked on successful retrieval of all the Address Books */
+function addressBooksCB(addressBooks)
+{
+ console.log(addressBooks.length + " address books available.");
+}
+
+/* Gets a list of available address books */
+tizen.contact.getAddressBooks(addressBooksCB, errorCB);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- var watcher = {
- oncontactsadded: function(contacts) {
- console.log(contacts.length + " contacts were added");
- },
- oncontactsupdated: function(contacts) {
- console.log(contacts.length + " contacts were updated");
- },
- oncontactsremoved: function(ids) {
- console.log(ids.length + " contacts were removed");
- }
- };
-
- // Registers to be notified when the address book changes.
- watcherId = addressbook.addChangeListener(watcher);
-
- // Adds a new contact to invoke an oncontactsadded call:
- try {
- var contact = new tizen.Contact({name : new tizen.ContactName({
- firstName : 'John', lastName : 'Doe',
- nicknames : ['Johnny']}),
- emails : [new tizen.ContactEmailAddress('john@doe.com')],
- phoneNumbers : [new tizen.ContactPhoneNumber('789456123')]});
- addressbook.add(contact);
- } catch (err) {
- console.log('An error occurred while adding a contact: ' + err.name + ", " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+var watcher =
+{
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + " contacts were added");
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + " contacts were updated");
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + " contacts were removed");
+ }
+};
+
+/* Registers to be notified when the address book changes */
+watcherId = addressbook.addChangeListener(watcher);
+
+/* Adds a new contact to invoke an oncontactsadded call */
+try
+{
+ var contact = new tizen.Contact(
+ {
+ name: new tizen.ContactName(
+ {
+ firstName: 'John',
+ lastName: 'Doe',
+ nicknames: ['Johnny']
+ }),
+ emails: [new tizen.ContactEmailAddress('john@doe.com')],
+ phoneNumbers: [new tizen.ContactPhoneNumber('789456123')]});
+ addressbook.add(contact);
+}
+catch (err)
+{
+ console.log('An error occurred while adding a contact: ' + err.name + ", " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBookChangeCallback::oncontactsupdated">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- var watcher = {
- oncontactsadded: function(contacts) {
- console.log(contacts.length + " contacts were added");
- },
- oncontactsupdated: function(contacts) {
- console.log(contacts.length + " contacts were updated");
- },
- oncontactsremoved: function(ids) {
- console.log(ids.length + " contacts were removed");
- }
- };
-
- // Registers to be notified when the address book changes.
- watcherId = addressbook.addChangeListener(watcher);
-
- // Updates a contact to invoke an oncontactsupdated call:
- function errorCB(error) {
- console.log(error.name + ": " + error.message);
- }
-
- function contactsFoundCB(contacts) {
- contacts[0].name.firstName = 'Stanley';
- try {
- addressbook.update(contacts[0]);
- console.log('Successfully updated.');
- } catch (error) {
- console.log(error.name + ": " + error.message);
- }
- }
-
- var filter = new tizen.AttributeFilter('name.lastName', 'EXACTLY', 'Doe');
- try {
- addressbook.find(contactsFoundCB, errorCB, filter);
- } catch (error) {
- console.log(error.name + ": " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+var watcher =
+{
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + " contacts were added");
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + " contacts were updated");
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + " contacts were removed");
+ }
+};
+
+/* Registers to be notified when the address book changes */
+watcherId = addressbook.addChangeListener(watcher);
+
+/* Updates a contact to invoke an oncontactsupdated call */
+function errorCB(error)
+{
+ console.log(error.name + ": " + error.message);
+}
+
+function contactsFoundCB(contacts)
+{
+ contacts[0].name.firstName = 'Stanley';
+ try
+ {
+ addressbook.update(contacts[0]);
+ console.log('Successfully updated.');
+ }
+ catch (error)
+ {
+ console.log(error.name + ": " + error.message);
+ }
+}
+
+var filter = new tizen.AttributeFilter('name.lastName', 'EXACTLY', 'Doe');
+try
+{
+ addressbook.find(contactsFoundCB, errorCB, filter);
+}
+catch (error)
+{
+ console.log(error.name + ": " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="AddressBookChangeCallback::oncontactsremoved">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var addressbook = tizen.contact.getDefaultAddressBook();
-
- var watcher = {
- oncontactsadded: function(contacts) {
- console.log(contacts.length + " contacts were added");
- },
- oncontactsupdated: function(contacts) {
- console.log(contacts.length + " contacts were updated");
- },
- oncontactsremoved: function(ids) {
- console.log(ids.length + " contacts were removed");
- }
- };
-
- // Registers to be notified when the address book changes.
- watcherId = addressbook.addChangeListener(watcher);
-
- // Removes a first contact whose name is 'Doe'
- // to invoke oncontactsremoved call:
- function onErrorCB(err) {
- console.log('An error occurred: ' + err.name);
- }
-
- function onContactsFoundCB(contacts) {
- if(contacts.length > 0) {
- try {
- addressbook.remove(contacts[0].id);
- console.log('First contact has been removed.');
- } catch (err) {
- console.log('An error occurred while removing: ' + err.name);
- }
- } else {
- console.log('No contacts to delete.');
- }
- }
-
- var filter = new tizen.AttributeFilter('name.lastName', 'EXACTLY', 'Doe');
- try {
- addressbook.find(onContactsFoundCB, onErrorCB, filter);
- } catch (err) {
- console.log('An error occured while finding: ' + err.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var addressbook = tizen.contact.getDefaultAddressBook();
+
+var watcher =
+{
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + " contacts were added");
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + " contacts were updated");
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + " contacts were removed");
+ }
+};
+
+/* Registers to be notified when the address book changes */
+watcherId = addressbook.addChangeListener(watcher);
+
+/* Removes a first contact whose name is 'Doe' to invoke oncontactsremoved call */
+function onErrorCB(err)
+{
+ console.log('An error occurred: ' + err.name);
+}
+
+function onContactsFoundCB(contacts)
+{
+ if (contacts.length > 0)
+ {
+ try
+ {
+ addressbook.remove(contacts[0].id);
+ console.log('First contact has been removed.');
+ }
+ catch (err)
+ {
+ console.log('An error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('No contacts to delete.');
+ }
+}
+
+var filter = new tizen.AttributeFilter('name.lastName', 'EXACTLY', 'Doe');
+try
+{
+ addressbook.find(onContactsFoundCB, onErrorCB, filter);
+}
+catch (err)
+{
+ console.log('An error occurred while finding: ' + err.name);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
-
- var watcher = {
- onpersonsadded: function(persons) {
- console.log(persons.length + " persons were added");
- },
- onpersonsupdated: function(persons) {
- console.log(persons.length + " persons were updated");
- },
- onpersonsremoved: function(ids) {
- console.log(ids.length + " persons were deleted");
- }
- };
-
- // Registers to be notified when the address book changes.
- watcherId = tizen.contact.addChangeListener(watcher);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+
+var watcher =
+{
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + " persons were added");
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + " persons were updated");
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + " persons were deleted");
+ }
+};
+
+/* Registers to be notified when the address book changes */
+watcherId = tizen.contact.addChangeListener(watcher);
+</pre>
</div>
</dd>
<dt class="method" id="PersonsChangeCallback::onpersonsupdated">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
-
- var watcher = {
- onpersonsadded: function(persons) {
- console.log(persons.length + " persons were added");
- },
- onpersonsupdated: function(persons) {
- console.log(persons.length + " persons were updated");
- },
- onpersonsremoved: function(ids) {
- console.log(ids.length + " persons were deleted");
- }
- };
-
- // Registers to be notified when the address book changes.
- watcherId = tizen.contact.addChangeListener(watcher);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+
+var watcher =
+{
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + " persons were added");
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + " persons were updated");
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + " persons were deleted");
+ }
+};
+
+/* Registers to be notified when the address book changes */
+watcherId = tizen.contact.addChangeListener(watcher);
+</pre>
</div>
</dd>
<dt class="method" id="PersonsChangeCallback::onpersonsremoved">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
-
- var watcher = {
- onpersonsadded: function(persons) {
- console.log(persons.length + " persons were added");
- },
- onpersonsupdated: function(persons) {
- console.log(persons.length + " persons were updated");
- },
- onpersonsremoved: function(ids) {
- console.log(ids.length + " persons were deleted");
- }
- };
-
- // Registers to be notified when the address book changes.
- watcherId = tizen.contact.addChangeListener(watcher);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+
+var watcher =
+{
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + " persons were added");
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + " persons were updated");
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + " persons were deleted");
+ }
+};
+
+/* Registers to be notified when the address book changes */
+watcherId = tizen.contact.addChangeListener(watcher);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Assume the content is a Content object as a result of find method.
- // Check the description is editable, and then set a description.
- if (content.editableAttributes.indexOf("description") >= 0) {
- content.description = "Sample content";
- }
- tizen.content.update(content);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assume the content is a Content object as a result of find method */
+/* Check the description is editable, and then set a description */
+if (content.editableAttributes.indexOf("description") >= 0)
+{
+ content.description = "Sample content";
+}
+tizen.content.update(content);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::updateBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example increases rating of an content by 1
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function successCB() {
- console.log('Attributes set successfully');
- }
-
- // Assume the content is a Content object as a result of find method.
- // Check the rating is editable, and then increase by 1.
- if (content.editableAttributes.indexOf("rating") >= 0) {
- content.rating++;
- }
- tizen.content.updateBatch([content], successCB, errorCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example increases rating of a content by 1 */
+
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function successCB()
+{
+ console.log('Attributes set successfully');
+}
+
+/* Assume the content is a Content object as a result of find method */
+/* Check the rating is editable, and then increase by 1 */
+if (content.editableAttributes.indexOf("rating") >= 0)
+{
+ content.rating++;
+}
+tizen.content.updateBatch([content], successCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::getDirectories">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example retrieves content directories in the storage.
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example retrieves content directories in the storage */
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function printDirectory(directory, index, directories) {
- console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
- }
- function getDirectoriesCB(directories) {
- directories.forEach(printDirectory);
- }
+function printDirectory(directory, index, directories)
+{
+ console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
+}
- tizen.content.getDirectories(getDirectoriesCB, errorCB);
- </pre>
+function getDirectoriesCB(directories)
+{
+ directories.forEach(printDirectory);
+}
+
+tizen.content.getDirectories(getDirectoriesCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::find">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the name.
- var count = 100;
- var offset = 0;
- var sortMode = new tizen.SortMode("name", "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('Name: ' + content.name + ' Title: ' + content.title + '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);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the name */
+var count = 100;
+var offset = 0;
+var sortMode = new tizen.SortMode("name", "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('Name: ' + content.name + ' Title: ' + content.title +
+ '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);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::scanFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example scan 'tizen.jpg' in media directory
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example scans 'tizen.jpg' in media directory */
- function successCB(path) {
- console.log('scanning is completed');
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- tizen.filesystem.resolve("images/tizen.jpg", function(imageFile) {
- tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
- });
+function successCB(path)
+{
+ console.log('scanning is completed');
+}
- </pre>
+tizen.filesystem.resolve("images/tizen.jpg", function(imageFile)
+{
+ tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
+});
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::scanDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example scans 'images' directory
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example scans 'images' directory */
- function successCB(path) {
- console.log('scanning is completed');
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- tizen.filesystem.resolve("images", function(directory) {
- tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
- });
+function successCB(path)
+{
+ console.log('scanning is completed');
+}
- </pre>
+tizen.filesystem.resolve("images", function(directory)
+{
+ tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
+});
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::cancelScanDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.content.cancelScanDirectory(directory.toURI());
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.content.cancelScanDirectory(directory.toURI());
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::addChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- // Adds the listener
- var listenerId = tizen.content.addChangeListener(listener);
-
- console.log('Listener ID: ' + listenerId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+/* Adds the listener */
+var listenerId = tizen.content.addChangeListener(listener);
+
+console.log('Listener ID: ' + listenerId);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Listener ID: 1
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- var listenerId = tizen.content.addChangeListener(listener);
-
- // Do some job here and when the listener is not needed anymore remove it
-
- // Removes the listener
- tizen.content.removeChangeListener(listenerId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+var listenerId = tizen.content.addChangeListener(listener);
+
+/* Do some job here and when the listener is not needed anymore remove it */
+
+/* Removes the listener */
+tizen.content.removeChangeListener(listenerId);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ContentManager::setChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener= {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- // Registers to be notified when the content changes
- tizen.content.setChangeListener(listener);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+/* Registers to be notified when the content changes */
+tizen.content.setChangeListener(listener);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ContentManager::unsetChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.content.unsetChangeListener();
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.content.unsetChangeListener();
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::getPlaylists">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::createPlaylist">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
- var gPlaylist;
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err.message);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
- }
-
- function findSuccess(contents) {
- if (contents.length > 0) {
- gPlaylist.add(contents[0]);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- }
-
- function findFail(err) {
- console.log("find FAIL: " + err.message);
- }
-
- function createSuccess(playlist) {
- console.log("create SUCCESS");
-
- gPlaylist = playlist;
- tizen.content.find(findSuccess, findFail, null,
- new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
- }
-
- function createFail(err) {
- console.log("create FAIL: " + err.message);
- }
-
- tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+var gPlaylist;
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err.message);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+}
+
+function findSuccess(contents)
+{
+ if (contents.length > 0)
+ {
+ gPlaylist.add(contents[0]);
+ }
+
+ tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+}
+
+function findFail(err)
+{
+ console.log("find FAIL: " + err.message);
+}
+
+function createSuccess(playlist)
+{
+ console.log("create SUCCESS");
+
+ gPlaylist = playlist;
+ tizen.content.find(findSuccess, findFail, null,
+ new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
+}
+
+function createFail(err)
+{
+ console.log("create FAIL: " + err.message);
+}
+
+tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::removePlaylist">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
-
- function removePlaylistSuccess() {
- console.log("removePlaylist SUCCESS");
- }
-
- function removePlaylistFail(err) {
- console.log("removePlaylist FAIL: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
-
- if(gPlaylists.length < 1) {
- console.log("Please add at least 1 playlist");
- return;
- }
-
- console.log("will remove playlist at index [0] name:"
- + gPlaylists[0].name);
-
- tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
- removePlaylistFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+
+function removePlaylistSuccess()
+{
+ console.log("removePlaylist SUCCESS");
+}
+
+function removePlaylistFail(err)
+{
+ console.log("removePlaylist FAIL: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+
+ if (gPlaylists.length < 1)
+ {
+ console.log("Please add at least 1 playlist");
+
+ return;
+ }
+
+ console.log("will remove playlist at index [0] name:"
+ + gPlaylists[0].name);
+
+ tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
+ removePlaylistFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::createThumbnail">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function createCB(path) {
- console.log("The thumbnail path is " + path);
- }
-
- function findCB(contents) {
- if (contents.length > 0) {
- tizen.content.createThumbnail(contents[0], createCB);
- }
- }
-
- tizen.content.find(findCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function createCB(path)
+{
+ console.log("The thumbnail path is " + path);
+}
+
+function findCB(contents)
+{
+ if (contents.length > 0)
+ {
+ tizen.content.createThumbnail(contents[0], createCB);
+ }
+}
+
+tizen.content.find(findCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> The thumbnail path is /home/owner/share/media/.thumb/phone/.jpg-bed1d5f494830f7a52e1217f1e924aff.jpg
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after remove) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist items:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 1) {
- console.log("Please add at least 1 tracks to playlist!");
- return;
- }
-
- console.log("Original playlist:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will remove item at index [0] name:" + gItems[0].content.name);
- gCurPlaylist.remove(gItems[0]);
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after remove) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 1)
+ {
+ console.log("Please add at least 1 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will remove item at index [0] name:" + gItems[0].content.name);
+ gCurPlaylist.remove(gItems[0]);
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::removeBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after remove batch) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist after remove batch:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function removeBatchSuccess() {
- console.log("removeBatch success");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function removeBatchFail(err) {
- console.log("removeBatch failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 4) {
- console.log("Please add at least 4 tracks to playlist!");
- return;
- }
-
- console.log("Original playlist:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will remove items at index [0](name:" + gItems[0].content.name
- + ") and at index [2](name:" + gItems[2].content.name + ")");
- gCurPlaylist.removeBatch([gItems[2], gItems[0]],
- removeBatchSuccess, removeBatchFail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after remove batch) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist after remove batch:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function removeBatchSuccess()
+{
+ console.log("removeBatch success");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function removeBatchFail(err)
+{
+ console.log("removeBatch failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 4)
+ {
+ console.log("Please add at least 4 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will remove items at index [0](name:" + gItems[0].content.name
+ + ") and at index [2](name:" + gItems[2].content.name + ")");
+ gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function getSuccess(items) {
- gItems = items;
- console.log("Playlist items:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].name);
- }
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- // To retrieves all playlist items of 'gCurPlaylist' playlist.
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function getSuccess(items)
+{
+ gItems = items;
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].name);
+ }
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ /* To retrieve all playlist items of 'gCurPlaylist' playlist */
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::setOrder">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist, gExpectedOrder;
-
- function get2Fail(err) {
- console.log("get items (after set order) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist order after setOrder:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function setOrderSuccess() {
- console.log("set items order SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function setOrderFail(err) {
- console.log("set items order failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 2) {
- console.log("Please add at least 2 tracks to playlist!");
- return;
- }
-
- console.log("Original order:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- gExpectedOrder = gItems.slice(0);
- gExpectedOrder.reverse();
-
- console.log("New order:");
- for(var i = 0; i < gExpectedOrder.length ; ++i) {
- console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
- }
-
- gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist, gExpectedOrder;
+
+function get2Fail(err)
+{
+ console.log("get items (after set order) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist order after setOrder:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function setOrderSuccess()
+{
+ console.log("set items order SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function setOrderFail(err)
+{
+ console.log("set items order failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ gExpectedOrder = gItems.slice(0);
+ gExpectedOrder.reverse();
+
+ console.log("New order:");
+ for (var i = 0; i < gExpectedOrder.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
+ }
+
+ gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::move">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after move item) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist order after move:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function moveSuccess() {
- console.log("move item SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function moveFail(err) {
- console.log("move item failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 2) {
- console.log("Please add at least 2 tracks to playlist!");
- return;
- }
-
- console.log("Original order:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will move item at index [1] (name: " +
- gItems[1].content.name + ") up by one place (to [0])");
-
- gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
- gItems.unshift(gItems.splice(1, 1)[0]);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after move item) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist order after move:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function moveSuccess()
+{
+ console.log("move item SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function moveFail(err)
+{
+ console.log("move item failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will move item at index [1] (name: " +
+ gItems[1].content.name + ") up by one place (to [0])");
+
+ gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
+ gItems.unshift(gItems.splice(1, 1)[0]);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
</dl>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Console API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Console API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Console">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log('A is for Alice.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log('A is for Alice.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>A is for Alice.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.error('B is for Bob.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.error('B is for Bob.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>B is for Bob.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.warn('C is for Christopher.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.warn('C is for Christopher.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>C is for Christopher.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.info('D is for Dorothy.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.info('D is for Dorothy.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>D is for Dorothy.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.debug('E is for Eve.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.debug('E is for Eve.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>E is for Eve.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var felix = 'Felix';
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var felix = 'Felix';
- // This assertion checks whether the first letter in name 'Felix' is 'A':
- console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.');
- </pre>
+/* This assertion checks whether the first letter in name 'Felix' is 'A' */
+console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Felix does not start with A.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var john = {name: "John", surname: "Doe"};
- console.dir(john.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var john = {name: "John", surname: "Doe"};
+console.dir(john.name);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>John
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var john = {name: "John", surname: "Doe"};
- console.dirxml(john.surname);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var john = {name: "John", surname: "Doe"};
+console.dirxml(john.surname);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Doe
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.time("Big array initialization");
- var array = new Array(1000000);
- for (var i = array.length - 1; i >= 0; i -= 1) {
- array[i] = new Object();
- };
- console.timeEnd("Big array initialization");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.time("Big array initialization");
+var array = new Array(1000000);
+for (var i = array.length - 1; i >= 0; i -= 1)
+{
+ array[i] = new Object();
+};
+console.timeEnd("Big array initialization");
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Big array initialization: 461.989ms
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.time("Big array initialization");
- var array = new Array(1000000);
- for (var i = array.length - 1; i >= 0; i -= 1) {
- array[i] = new Object();
- };
- console.timeEnd("Big array initialization");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.time("Big array initialization");
+var array = new Array(1000000);
+for (var i = array.length - 1; i >= 0; i -= 1)
+{
+ array[i] = new Object();
+};
+console.timeEnd("Big array initialization");
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Big array initialization: 461.989ms
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Cordova API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Cordova API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Cordova">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>DeviceMotion API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>DeviceMotion API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::DeviceMotion">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
- </pre>
+navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- console.log('Please wait 3 seconds for the next measurement...');
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ console.log('Please wait 3 seconds for the next measurement...');
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- var options = { frequency: 3000 }; // Update every 3 seconds
+var options = {frequency: 3000}; /* Update every 3 seconds */
- var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
- </pre>
+var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var counter = 0, watchID;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var counter = 0, watchID;
- function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- if(3 == ++counter) {
- navigator.accelerometer.clearWatch(watchID);
- }
- };
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ if (3 == ++counter)
+ {
+ navigator.accelerometer.clearWatch(watchID);
+ }
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- var options = { frequency: 30 }; // Update every 0.03 seconds
+var options = {frequency: 30}; /* Update every 0.03 seconds */
- watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
- </pre>
+watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Device API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Device API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Device">
Returns the version of Cordova running on the device.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Cordova: ' + device.cordova);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Cordova: ' + device.cordova);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Cordova: 5.1.1
Get the the name of the device's model or product. The value is set by the device manufacturer and may be different across versions of the same product.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Model: ' + device.model);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Model: ' + device.model);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Model: tm1
Get the device's operating system name.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Platform: ' + device.platform);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Platform: ' + device.platform);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Platform: Tizen
Get the device's Universally Unique Identifier (UUID). The details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device UUID: ' + device.uuid);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device UUID: ' + device.uuid);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device UUID: 2LR1b3MXfEUSFvH04m4e1EXYvQA=
Get the operating system version.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Version: ' + device.version);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Version: ' + device.version);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Version: 3.0
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Dialogs API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Dialogs API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Dialogs">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alertDismissed = function() {
- console.log('Alert was dismissed');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alertDismissed = function()
+{
+ console.log('Alert was dismissed');
+}
- navigator.notification.alert('Please click OK button', alertDismissed,
- 'OK click alert', 'OK');
- </pre>
+navigator.notification.alert('Please click OK button', alertDismissed,
+ 'OK click alert', 'OK');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Alert was dismissed
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var confirmCallback = function(buttonIndex) {
- console.log('Selected option was ' + buttonIndex);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var confirmCallback = function(buttonIndex)
+{
+ console.log('Selected option was ' + buttonIndex);
+}
- navigator.notification.confirm('Choose one option', confirmCallback,
- 'Options', ['Option1', 'Option2']);
- </pre>
+navigator.notification.confirm('Choose one option', confirmCallback,
+ 'Options', ['Option1', 'Option2']);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Selected option was 1
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var promptCallback = function(results) {
- console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var promptCallback = function(results)
+{
+ console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
+}
- navigator.notification.prompt('Please enter your name',
- promptCallback,
- 'Registration Box',
- ['Ok', 'Exit'],
- 'e.g. Jane Doe');
- </pre>
+navigator.notification.prompt('Please enter your name', promptCallback,
+ 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Hello Jane Doe, you selected option 1
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var times = 2;
- console.log('Device would beep ' + times + ' times');
- navigator.notification.beep(times);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var times = 2;
+console.log('Device would beep ' + times + ' times');
+navigator.notification.beep(times);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device would beep 2 times
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Events API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Events API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Events">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.deviceready.html">Cordova deviceredy event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- // Now safe to use device APIs
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ /* Now safe to use device APIs */
+}
+</pre>
</div>
</div>
<div class="interface" id="PauseEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.pause.html">Cordova pause event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('pause', onPause, false);
- }
-
- function onPause() {
- // Handle the pause event
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('pause', onPause, false);
+}
+
+function onPause()
+{
+ /* Handle the pause event */
+}
+</pre>
</div>
</div>
<div class="interface" id="ResumeEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.resume.html">Cordova resume event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('resume', onResume, false);
- }
-
- function onResume() {
- // Handle the resume event
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('resume', onResume, false);
+}
+
+function onResume()
+{
+ /* Handle the resume event */
+}
+</pre>
</div>
</div>
<div class="interface" id="BackButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.backbutton.html">Cordova backbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('backbutton', onBackKeyDown, false);
- }
-
- function onBackKeyDown() {
- // Handle the back button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('backbutton', onBackKeyDown, false);
+}
+
+function onBackKeyDown()
+{
+ /* Handle the back button */
+}
+</pre>
</div>
</div>
<div class="interface" id="MenuButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.menubutton.html">Cordova menubutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('menubutton', onMenuKeyDown, false);
- }
-
- function onMenuKeyDown() {
- // Handle the back button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('menubutton', onMenuKeyDown, false);
+}
+
+function onMenuKeyDown()
+{
+ /* Handle the back button */
+}
+</pre>
</div>
</div>
<div class="interface" id="SearchButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.searchbutton.html">Cordova searchbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('searchbutton', onSearchKeyDown, false);
- }
-
- function onSearchKeyDown() {
- // Handle the search button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('searchbutton', onSearchKeyDown, false);
+}
+
+function onSearchKeyDown()
+{
+ /* Handle the search button */
+}
+</pre>
</div>
</div>
<div class="interface" id="StartCallEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.startcallbutton.html">Cordova startcallbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('startcallbutton', onStartCallKeyDown, false);
- }
-
- function onStartCallKeyDown() {
- // Handle the start call button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('startcallbutton', onStartCallKeyDown, false);
+}
+
+function onStartCallKeyDown()
+{
+ /* Handle the start call button */
+}
+</pre>
</div>
</div>
<div class="interface" id="EndCallButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.endcallbutton.html">Cordova endcallbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('endcallbutton', onEndCallKeyDown, false);
- }
-
- function onEndCallKeyDown() {
- // Handle the end call button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('endcallbutton', onEndCallKeyDown, false);
+}
+
+function onEndCallKeyDown()
+{
+ /* Handle the end call button */
+}
+</pre>
</div>
</div>
<div class="interface" id="VolumeDownButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.volumedownbutton.html">Cordova volumedownbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
- }
-
- function onVolumeDownKeyDown() {
- // Handle the volume down button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
+}
+
+function onVolumeDownKeyDown()
+{
+ /* Handle the volume down button */
+}
+</pre>
</div>
</div>
<div class="interface" id="VolumeUpButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.volumeupbutton.html">Cordova volumeupbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
- }
-
- function onVolumeUpKeyDown() {
- // Handle the volume up button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
+}
+
+function onVolumeUpKeyDown()
+{
+ /* Handle the volume up button */
+}
+</pre>
</div>
</div>
</div>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>File API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>File API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::File">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var eventInit = {
- loaded: 128,
- total: 1024
- };
- var event = new ProgressEvent('submit', eventInit);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var eventInit =
+{
+ loaded: 128,
+ total: 1024
+};
+var event = new ProgressEvent('submit', eventInit);
+</pre>
</div>
<div class="constructors">
<h4 id="ProgressEvent::constructor">Constructors</h4>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The directory where the application is installed " + cordova.file.applicationDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("The directory where the application is installed " + cordova.file.applicationDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>The directory where the application is installed file:///opt/usr/apps/WfigBlWDyf/res/wgt/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Root directory of the application's sandbox file:///opt/usr/apps/WfigBlWDyf/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Data directory " + cordova.file.dataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Data directory " + cordova.file.dataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Data directory file:///opt/usr/apps/WfigBlWDyf/data/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Cache directory " + cordova.file.cacheDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Cache directory " + cordova.file.cacheDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Cache directory file:///opt/usr/apps/WfigBlWDyf/tmp/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Space on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Data files on external storage " + cordova.file.externalDataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Data files on external storage " + cordova.file.externalDataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Data files on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Cache on external storage " + cordova.file.externalCacheDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Cache on external storage " + cordova.file.externalCacheDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Cache on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Root on external storage " + cordova.file.externalRootDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Root on external storage " + cordova.file.externalRootDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Root on external storage file:///usr/storage/sdcard/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Temp directory " + cordova.file.tempDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Temp directory " + cordova.file.tempDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Temp directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Synced data directory " + cordova.file.syncedDataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Synced data directory " + cordova.file.syncedDataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Synced data directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Documents directory " + cordova.file.documentsDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Documents directory " + cordova.file.documentsDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Documents directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Files globally available to all applications " + cordova.file.sharedDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Files globally available to all applications " + cordova.file.sharedDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Files globally available to all applications file:///opt/usr/media/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function (fileSystem) {
- console.log('Name of the filesystem: '+fileSystem.name);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fileSystem)
+{
+ console.log('Name of the filesystem: ' + fileSystem.name);
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Name of the filesystem: temporary
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(fs) {
- console.log('File system name ' + fs.name);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- requestFileSystem(TEMPORARY, 1024*1024, successCallback, errorCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(fs)
+{
+ console.log('File system name ' + fs.name);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>File system name temporary
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry) {
- console.log('Entry name ' + entry.name);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- var uri = 'file:///home/owner/content/Documents/example.txt';
- resolveLocalFileSystemURL(uri, successCallback, errorCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry)
+{
+ console.log('Entry name ' + entry.name);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+var uri = 'file:///home/owner/content/Documents/example.txt';
+resolveLocalFileSystemURL(uri, successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Entry name example.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getMetadata(function (metadata) {
- console.log("Last modification time: " + metadata.modificationTime);// get metadata successfully
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getMetadata(function(metadata)
+ {
+ console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Last modification time: Fri Jan 02 2015 03:58:08 GMT+0900 (KST)
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry){console.log('Full path to the moved file: '+entry.fullPath)};
- requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry) {
- fs.root.getFile("aa.txt", {create:true}, function(fileentry) {
- console.log('Full path before move: '+fileentry.fullPath);
- fileentry.moveTo(direntry,'newname.txt',successCallback);
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry) {console.log('Full path to the moved file: ' + entry.fullPath)};
+
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("aa.txt", {create:true}, function(fileentry)
+ {
+ console.log('Full path before move: ' + fileentry.fullPath);
+ fileentry.moveTo(direntry, 'newname.txt', successCallback);
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Full path before move: /aa.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry){console.log('Full path to the copied file: '+entry.fullPath);};
- requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true},
- function(direntry) {
- fs.root.getFile("test.txt", {create:true},
- function(fileentry) {
- fileentry.copyTo(direntry,'newname.txt',successCallback);
- }
- );
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry) {console.log('Full path to the copied file: ' + entry.fullPath);};
+
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("test.txt", {create:true}, function(fileentry)
+ {
+ fileentry.copyTo(direntry, 'newname.txt', successCallback);
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Full path to the copied file: /testDirectory/newname.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getParent(function (entry) {
- console.log("success");
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getParent(function(entry)
+ {
+ console.log("success");
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile('test.txt', {create: true}, function(fileEntry) {
- fileEntry.remove(function () {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile('test.txt', {create: true}, function(fileEntry)
+ {
+ fileEntry.remove(function()
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
URL that can be used to identify this entry.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true},
- function(entry) {
- var url = entry.toURL();
- console.log('URL: '+url);
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(entry)
+ {
+ var url = entry.toURL();
+ console.log('URL: ' + url);
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>URL: file:///home/owner/apps_rw/WfigBlWDyf/tmp/testDirectory/
DirectoryReader
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function (entry) {
- entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry) {
- var directoryReader = dirEntry.createReader();
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(entry)
+{
+ entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
+ {
+ var directoryReader = dirEntry.createReader();
+ });
+});
+</pre>
</div>
</dd>
<dt class="method" id="DirectoryEntry::getDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory("ert",{create:true},function(dir){
- console.log('Created dir: '+dir.name);
- })
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory("ert", {create:true}, function(dir)
+ {
+ console.log('Created dir: ' + dir.name);
+ })
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Created dir: ert
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("qa.txt",{create:true},function(file){
- console.log('Created file: '+file.name);
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("qa.txt", {create:true}, function(file)
+ {
+ console.log('Created file: ' + file.name);
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Created file: qa.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory("testDirectory", {create:true},
- function(directoryEntry) {
- directoryEntry.removeRecursively(function() {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
+ {
+ directoryEntry.removeRecursively(function()
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- var a = fs.root.createReader();
- a.readEntries(function successCallback(entries) {
- console.log("success");
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ var a = fs.root.createReader();
+ a.readEntries(function successCallback(entries)
+ {
+ console.log("success");
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("logFile.txt", {create: true}, function (f) {
- f.createWriter(function(fileWriter) {
- fileWriter.write(new Blob(['hello']));
- fileWriter.onerror = function(e) {
- console.log('Write file failed:' + e);
- };
- fileWriter.onwriteend = function () {
- console.log("success");
- };
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("logFile.txt", {create: true}, function(f)
+ {
+ f.createWriter(function(fileWriter)
+ {
+ fileWriter.write(new Blob(['hello']));
+ fileWriter.onerror = function(e)
+ {
+ console.log('Write file failed:' + e);
+ };
+ fileWriter.onwriteend = function()
+ {
+ console.log("success");
+ };
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("abcdz.txt", {create: true}, function (f) {
- f.file(function (file) {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("abcdz.txt", {create: true}, function(f)
+ {
+ f.file(function(file)
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var deviceReady, fileReader;
- deviceReady = function() {
- fileReader = new FileReader();
- };
- document.addEventListener('deviceready', deviceReady, true);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var deviceReady, fileReader;
+deviceReady = function()
+{
+ fileReader = new FileReader();
+};
+document.addEventListener('deviceready', deviceReady, true);
+</pre>
</div>
<div class="constructors">
<h4 id="FileReader::constructor">Constructors</h4>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded');
- };
- fileReader.onabort = function(){
- console.log('aborted');
- };
- fileReader.readAsDataURL(blob);
- fileReader.abort();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded');
+};
+fileReader.onabort = function()
+{
+ console.log('aborted');
+};
+fileReader.readAsDataURL(blob);
+fileReader.abort();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>aborted
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsDataURL(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsDataURL(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = data:;base64,YWJj
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsText(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsText(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = abc
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsBinaryString(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsBinaryString(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = abc
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- resultValue = fileReader.result;
- console.log("Result: "+resultValue.toString()+'<br>'+'ByteLength: '+resultValue.byteLength);
- };
- fileReader.readAsArrayBuffer(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ resultValue = fileReader.result;
+ console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
+};
+fileReader.readAsArrayBuffer(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Result: [object ArrayBuffer]
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('write success');
- };
- writer.onabort = function(e){
- console.log('abort');
- };
- writer.write('some sample text');
- writer.abort();
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+ writer.onabort = function(e)
+ {
+ console.log('abort');
+ };
+ writer.write('some sample text');
+ writer.abort();
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>abort
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- // fast forwards file pointer to the end of file.
- writer.seek(writer.length);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ /* Fast forwards file pointer to the end of file */
+ writer.seek(writer.length);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="FileWriter::truncate">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('truncate success');
- };
-
- writer.truncate(10);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('truncate success');
+ };
+
+ writer.truncate(10);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>truncate success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('write success');
- };
-
- writer.write('some sample text');
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+
+ writer.write('some sample text');
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>write success
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>FileTransfer API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>FileTransfer API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::FileTransfer">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // We assume the variable fileURL contains a valid URL to a text file on the device.
-
- var win = function (r) {
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
- }
-
- var fail = function (error) {
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- }
-
- var options = new FileUploadOptions();
- options.fileKey = 'file';
- options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
- options.mimeType = 'text/plain';
-
- var params = {};
- params.value1 = 'test';
- params.value2 = 'param';
-
- options.params = params;
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail, options);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Assume the variable fileURL contains a valid URL to a text file on the device */
+
+var win = function(r)
+{
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
+}
+
+var fail = function(error)
+{
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+}
+
+var options = new FileUploadOptions();
+options.fileKey = 'file';
+options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
+options.mimeType = 'text/plain';
+
+var params = {};
+params.value1 = 'test';
+params.value2 = 'param';
+
+options.params = params;
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Code = 200
<dl>
<pre class="webidl prettyprint">FileUploadOptions(DOMString fileKey, DOMString fileName, DOMString mimeType, <a href="#FileUploadParams">FileUploadParams</a> params, <a href="#HeaderFields">HeaderFields</a> headers, DOMString httpMethod);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a FileUploadOptions object.
- var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a FileUploadOptions object */
+var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
+</pre>
</div>
</dl>
</div>
<dl>
<pre class="webidl prettyprint">FileTransfer();</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a FileTransfer object.
- var file_transfer = new FileTransfer();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a FileTransfer object */
+var file_transfer = new FileTransfer();
+</pre>
</div>
</dl>
</div>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function(r) {
- console.log('Success. File uploaded.');
- }
-
- var fail = function(error) {
- // error.code == FileTransferError.ABORT_ERR
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- };
-
- var ft = new FileTransfer();
-
- ft.onprogress = function(event) {
- console.log('uploaded: ' + event.loaded);
- };
-
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Success. File uploaded.');
+}
+
+var fail = function(error)
+{
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+};
+
+var ft = new FileTransfer();
+
+ft.onprogress = function(event)
+{
+ console.log('uploaded: ' + event.loaded);
+};
+
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>uploaded: 512
uploaded: 1024
-Success. File uploaded.
+Success. File uploaded.
</pre>
</div>
</li></ul>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function (r) {
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
- }
-
- var fail = function (error) {
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- }
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
+}
+
+var fail = function(error)
+{
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+}
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Code = 200
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var fileTransfer = new FileTransfer();
- var uri = encodeURI('http://some.server.com/download.php');
-
- fileTransfer.download(
- uri,
- fileURL,
- function(entry) {
- console.log('download complete: ' + entry.toURL());
- },
- function(error) {
- console.log('download error source ' + error.source);
- console.log('download error target ' + error.target);
- console.log('upload error code' + error.code);
- },
- false,
- {
- headers: {
- 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var fileTransfer = new FileTransfer();
+var uri = encodeURI('http://some.server.com/download.php');
+
+fileTransfer.download(uri, fileURL, function(entry)
+{
+ console.log('download complete: ' + entry.toURL());
+}, function(error)
+{
+ console.log('download error source ' + error.source);
+ console.log('download error target ' + error.target);
+ console.log('upload error code' + error.code);
+}, false,
+{
+ headers:
+ {
+ 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
+ }
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>download complete: file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
http://tizen.org/privilege/internet
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function(r) {
- console.log('Should not be called.');
- }
-
- var fail = function(error) {
- // error.code == FileTransferError.ABORT_ERR
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- };
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- ft.abort();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Should not be called.');
+}
+
+var fail = function(error)
+{
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+};
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+ft.abort();
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre>An error has occured: Code = 4
+<span class="title"><p>Output example:</p></span><pre>An error has occurred: Code = 4
upload error source file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
upload error target http://some.server.com/file.txt
</pre>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Globalization API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Globalization API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Globalization">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output the text
- // similar to the results that follow.
-
- navigator.globalization.getPreferredLanguage(
- function (language) { console.log('Language: ' + language.value); },
- function () { console.log('Error getting language.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text
+ similar to the results that follow
+*/
+navigator.globalization.getPreferredLanguage(function(language)
+{
+ console.log('Language: ' + language.value);
+}, function()
+{
+ console.log('Error getting language.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Language: en-US
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output the text
- // similar to the results that follow.
-
- navigator.globalization.getLocaleName(
- function (locale) { console.log('Locale: ' + locale.value); },
- function () { console.log('Error getting locale.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text
+ similar to the results that follow
+*/
+navigator.globalization.getLocaleName(function(locale)
+{
+ console.log('Locale: ' + locale.value);
+}, function()
+{
+ console.log('Error getting locale.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Locale: en-US
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output text similar to the results that follow.
- // This example uses the default conversion options.
-
- navigator.globalization.dateToString(
- new Date(),
- function (date) { console.log('Date: ' + date.value); },
- function () { console.log('Error getting dateString.'); },
- { formatLength: 'short', selector: 'date and time' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text similar to the results that follow
+ This example uses the default conversion options
+*/
+navigator.globalization.dateToString(new Date(), function(date)
+{
+ console.log('Date: ' + date.value);
+}, function()
+{
+ console.log('Error getting dateString.');
+}, {formatLength: 'short', selector: 'date and time'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Date: 9/25/2012 4:21PM
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US locale and the selected
- // currency is United States Dollars, this example outputs
- // text similar to the results that follow.
-
- navigator.globalization.getCurrencyPattern(
- 'USD',
- function (pattern) {
- console.log('pattern: ' + pattern.pattern);
- console.log('code: ' + pattern.code);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
- },
- function () { console.log('Error getting pattern.'); }
- );
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ and the selected currency is United States Dollars,
+ this outputs the text similar to the results that follow
+*/
+navigator.globalization.getCurrencyPattern('USD', function(pattern)
+{
+ console.log('pattern: ' + pattern.pattern);
+ console.log('code: ' + pattern.code);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
+}, function()
+{
+ console.log('Error getting pattern.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>pattern: $#,##0.##;($#,##0.##)
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this example logs the names of months, as per locale settings,
- // with text similar to the results that follow.
-
- navigator.globalization.getDateNames(
- function (names) {
- for (var i = 0; i < names.value.length; i++) {
- console.log('month: ' + names.value[i]);
- }
- },
- function () { console.log('Error getting names.'); },
- { type: 'wide', item: 'months' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this example logs the names of months, as per locale settings
+ with text similar to the results that follow
+*/
+navigator.globalization.getDateNames(function(names)
+{
+ for (var i = 0; i < names.value.length; i++)
+ {
+ console.log('month: ' + names.value[i]);
+ }
+}, function()
+{
+ console.log('Error getting names.');
+}, {type: 'wide', item: 'months'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>month: January
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // This example displays the locale date pattern.
- // When the browser is set to the en_US locale,
- // the text displayed is similar to the results that follow.
-
- function checkDatePattern () {
- navigator.globalization.getDatePattern(
- function (date) { console.log('Date pattern: ' + date.pattern); },
- function () { console.log('Error getting pattern'); },
- { formatLength: 'short', selector: 'date and time' }
- );
- }
-
- checkDatePattern();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ This example displays the locale date pattern
+ When the browser is set to the en-US locale,
+ this outputs the text similar to the results that follow
+*/
+function checkDatePattern()
+{
+ navigator.globalization.getDatePattern(function(date)
+ {
+ console.log('Date pattern: ' + date.pattern);
+ }, function()
+ {
+ console.log('Error getting pattern');
+ }, {formatLength: 'short', selector: 'date and time'});
+}
+
+checkDatePattern();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Date pattern: M/d/yyyy h:mm a
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this outputs the text similar to "day: 1".
-
- navigator.globalization.getFirstDayOfWeek(
- function (day) { console.log('day: ' + day.value); },
- function () { console.log('Error getting first day of week.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this outputs the text similar to "day: 1"
+*/
+navigator.globalization.getFirstDayOfWeek(function(day)
+{
+ console.log('day: ' + day.value);
+}, function()
+{
+ console.log('Error getting first day of week.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>day: 1
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this example outputs the text
- // similar to the results that follow.
-
- navigator.globalization.getNumberPattern(
- function (pattern) {
- console.log('pattern: ' + pattern.pattern);
- console.log('symbol: ' + pattern.symbol);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('positive: ' + pattern.positive);
- console.log('negative: ' + pattern.negative);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
- },
- function() { console.log('An error occurred.'); },
- { type: 'decimal' }
- );
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this outputs the text similar to the results that follow
+*/
+navigator.globalization.getNumberPattern(function(pattern)
+{
+ console.log('pattern: ' + pattern.pattern);
+ console.log('symbol: ' + pattern.symbol);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('positive: ' + pattern.positive);
+ console.log('negative: ' + pattern.negative);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
+}, function()
+{
+ console.log('An error occurred.');
+}, {type: 'decimal'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>pattern: #,##0.###
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // During the summer, and if the browser
- // is set to a DST-enabled timezone,
- // this should log text similar to "dst: true":
-
- navigator.globalization.isDayLightSavingsTime(
- new Date(),
- function (date) { console.log('dst: ' + date.dst); },
- function () { console.log('Error getting the DST state.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ During the summer, and if the browser is set to a DST-enabled timezone,
+ this logs text similar to "dst: true"
+*/
+navigator.globalization.isDayLightSavingsTime(new Date(), function(date)
+{
+ console.log('dst: ' + date.dst);
+}, function()
+{
+ console.log('Error getting the DST state.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>dst: true
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this code displays the results that follow.
-
- navigator.globalization.numberToString(
- 3.1415926,
- function (number) { console.log('decimal number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
-
- navigator.globalization.numberToString(
- 1000003,
- function (number) { console.log('big decimal number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
-
- navigator.globalization.numberToString(
- 0.3183099,
- function (number) { console.log('percentile: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'percent' }
- );
-
- navigator.globalization.numberToString(
- 1099.95,
- function (number) { console.log('currency: ' + number.value); },
- function () { console.log('Error getting number'); },
- { type: 'currency' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this code displays the results that follow
+*/
+navigator.globalization.numberToString(3.1415926, function(number)
+{
+ console.log('decimal number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+
+navigator.globalization.numberToString(1000003, function(number)
+{
+ console.log('big decimal number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+
+navigator.globalization.numberToString(0.3183099, function(number)
+{
+ console.log('percentile: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'percent'});
+
+navigator.globalization.numberToString(1099.95, function(number)
+{
+ console.log('currency: ' + number.value);
+}, function()
+{
+ console.log('Error getting number');
+}, {type: 'currency'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>decimal number: 3.142
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // when the browser is set to the en_US locale,
- // this example outputs text similar to the results that follow.
- // Note that the month integer is one less than the string,
- // as the month integer represents an array index.
-
- navigator.globalization.stringToDate(
- '9/25/2012',
- function (date) {
- console.log('month: ' + date.month +
- ', day: ' + date.day +
- ', year: ' + date.year)
- },
- function () { console.log('Error getting date.'); },
- { selector: 'date' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this example outputs text similar to the results that follow
+ Note that the month integer is one less than the string,
+ as the month integer represents an array index
+*/
+navigator.globalization.stringToDate('9/25/2012', function(date)
+{
+ console.log('month: ' + date.month +
+ ', day: ' + date.day +
+ ', year: ' + date.year)
+}, function()
+{
+ console.log('Error getting date.');
+}, {selector: 'date'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>month: 8, day: 25, year: 2012
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this should display the text similar to the results that follow.
-
- navigator.globalization.stringToNumber(
- '1234.56',
- function (number) { console.log('number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this displays the text similar to the results that follow
+*/
+navigator.globalization.stringToNumber('1234.56', function(number)
+{
+ console.log('number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>number: 1234.56
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Media API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Media API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Media">
void stop();
};</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myMedia = new Media(src, successCallback, errorCallback, statusCallback);</pre>
</div>
<div class="constructors">
<h4 id="Media::constructor">Constructors</h4>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- positionSuccessCallback = function(position) {
- console.log('Current position is ' + position);
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- setTimeout(function() {
- myMedia.getCurrentPosition(positionSuccessCallback);
- }, 2000);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+positionSuccessCallback = function(position)
+{
+ console.log('Current position is ' + position);
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+setTimeout(function()
+{
+ myMedia.getCurrentPosition(positionSuccessCallback);
+}, 2000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been played back.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.);
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- var duration = myMedia.getDuration();
- console.log('Audio duration is ' + duration);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+var duration = myMedia.getDuration();
+console.log('Audio duration is ' + duration);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio duration is 281.035
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- statusCallback = function(status) {
- if (status == Media.MEDIA_PAUSED) {
- console.log('Audio file has been paused');
- }
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
-
- myMedia.play();
-
- //Pause after 2 seconds
- setTimeout(function() {
- myMedia.pause();
- }, 2000);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+statusCallback = function(status)
+{
+ if (status == Media.MEDIA_PAUSED)
+ {
+ console.log('Audio file has been paused');
+ }
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
+
+myMedia.play();
+
+/* Pause after 2 seconds */
+setTimeout(function()
+{
+ myMedia.pause();
+}, 2000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been paused.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
- myMedia.play();
- </pre>
+myMedia.play();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been played back.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been stopped or released.');
- }
-
- errorCallback = function(err) {
- console.log('An error occurred: ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
- myMedia.stop();
- myMedia.release();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been stopped or released.');
+}
+
+errorCallback = function(err)
+{
+ console.log('An error occurred: ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+myMedia.stop();
+myMedia.release();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been stopped or released.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('An error occurred: ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- //SeekTo to 10 seconds after 5 seconds
- setTimeout(function() {
- myMedia.seekTo(10000);
- console.log('Playback position has been set to 10 seconds.');
- }, 5000);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('An error occurred: ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* SeekTo to 10 seconds after 5 seconds */
+setTimeout(function()
+{
+ myMedia.seekTo(10000);
+ console.log('Playback position has been set to 10 seconds.');
+}, 5000);
</pre>
</div>
<div class="output">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- // Mute volume after 2 seconds
- setTimeout(function() {
- myMedia.setVolume(0.0);
- console.log('Playback volume has been muted.');
- }, 2000);
-
- // Set volume to 1.0 after 5 seconds
- setTimeout(function() {
- myMedia.setVolume(1.0);
- console.log('Playback volume has been set to 1.0.');
- }, 5000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* Mute volume after 2 seconds */
+setTimeout(function()
+{
+ myMedia.setVolume(0.0);
+ console.log('Playback volume has been muted.');
+}, 2000);
+
+/* Set volume to 1.0 after 5 seconds */
+setTimeout(function()
+{
+ myMedia.setVolume(1.0);
+ console.log('Playback volume has been set to 1.0.');
+}, 5000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Playback volume has been muted.
http://tizen.org/privilege/mediacapture
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Started recording an audio file.');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Started recording an audio file.');
+}
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
- var src = 'recordAudio.mp3';
- var myRecMedia = new Media(src, successCallback, errorCallback);
+var src = 'recordAudio.mp3';
+var myRecMedia = new Media(src, successCallback, errorCallback);
- myRecMedia.startRecord();
- </pre>
+myRecMedia.startRecord();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Started recording an audio file.
http://tizen.org/privilege/mediacapture
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Started recording an audio file.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'recordAudio.mp3';
- var myRecMedia = new Media(src, successCallback, errorCallback);
-
- myRecMedia.startRecord();
-
- // Stop recording after 10 seconds
- setTimeout(function() {
- myRecMedia.stopRecord();
- console.log('Stopped recording an audio file.');
- }, 10000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Started recording an audio file.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'recordAudio.mp3';
+var myRecMedia = new Media(src, successCallback, errorCallback);
+
+myRecMedia.startRecord();
+
+/* Stop recording after 10 seconds */
+setTimeout(function()
+{
+ myRecMedia.stopRecord();
+ console.log('Stopped recording an audio file.');
+}, 10000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Started recording an audio file.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been stopped.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- // Stop after 10 seconds
- setTimeout(function() {
- myMedia.stop();
- }, 10000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been stopped.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* Stop after 10 seconds */
+setTimeout(function()
+{
+ myMedia.stop();
+}, 10000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio playback has been stopped.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>NetworkInformation API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>NetworkInformation API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::NetworkInformation">
http://tizen.org/privilege/telephony
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function checkConnection() {
- var networkState = navigator.connection.type;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function checkConnection()
+{
+ var networkState = navigator.connection.type;
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
- alert('Connection type: ' + states[networkState]);
- }
+ var states = {};
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+ alert('Connection type: ' + states[networkState]);
+}
- checkConnection();
- </pre>
+checkConnection();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Connection type: Cell 3G connection
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.UNKNOWN);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.UNKNOWN);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>unknown
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.ETHERNET);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.ETHERNET);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>ethernet
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.WIFI);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.WIFI);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>wifi
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_2G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_2G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>2g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_3G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_3G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>3g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_4G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_4G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>4g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>cellular
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.NONE);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.NONE);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>none
Original documentation: <a href="https://www.npmjs.com/package/cordova-plugin-network-information#online">Cordova online event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- document.addEventListener('online', onOnline, false);
- }
+function onDeviceReady()
+{
+ document.addEventListener('online', onOnline, false);
+}
- function onOnline() {
- // Handle the online event
- }
- </pre>
+function onOnline()
+{
+ /* Handle the online event */
+}
+</pre>
</div>
</div>
<div class="interface" id="OfflineEventCallback">
Original documentation: <a href="https://www.npmjs.com/package/cordova-plugin-network-information#offline">Cordova offline event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- document.addEventListener('offline', onOffline, false);
- }
+function onDeviceReady()
+{
+ document.addEventListener('offline', onOffline, false);
+}
- function onOffline() {
- // Handle the offline event
- }
- </pre>
+function onOffline()
+{
+ /* Handle the offline event */
+}
+</pre>
</div>
</div>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //The data provider, a native application, should be pre-installed and launched.
- //The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer).
- //In this example, the DictionaryDataControlProvider native sample application is used as a data control provider.
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ The data provider, a native application, should be pre-installed and launched
+ The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer)
+ In this example, the DictionaryDataControlProvider native sample application is used as a data control provider
+*/
- //Gets SQL type DataControlConsumerObject
- try {
- var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- // Gets MAP type DataControlConsumerObject
- try {
- globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+/* Gets SQL type DataControlConsumerObject */
+try
+{
+ var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
+}
+catch (err)
+{
+ console.log(err.name +": " + err.message);
+}
+/* Gets MAP type DataControlConsumerObject */
+try
+{
+ globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
+}
+catch (err)
+{
+ console.log(err.name +": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id, insertRowId)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id, insertRowId)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- var rowData = {
- columns : ["WORD", "WORD_DESC"] ,
- values : ["'tizen1'", "'tizen2'"]
- };
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'tizen2'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- var rowData = {
- columns : ["WORD", "WORD_DESC"] ,
- values : ["'tizen1'", "'Web apps platform!'"]
- };
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'Web apps platform!'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::select">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function getValueSuccessCB(result, id)
- {
- console.log("getValueSuccessCB result.length: " + result.length);
- var length = result.length;
- for (var i = 0; i < length; i++)
- {
- var rowData = "| ";
- var j = 0;
- for (j = 0; j < result[i].columns.length; j++)
- {
- rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
- }
- console.log(rowData);
- }
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function getValueSuccessCB(result, id)
+{
+ console.log("getValueSuccessCB result.length: " + result.length);
+ var length = result.length;
+ for (var i = 0; i < length; i++)
+ {
+ var rowData = "| ";
+ var j = 0;
+ for (j = 0; j < result[i].columns.length; j++)
+ {
+ rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
+ }
+ console.log(rowData);
+ }
+}
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
-
- try {
- // globalSQLConsumer and globalReqId should be defined before.
- // Increases globalReqId for uniqueness
- var columns = ["WORD", "WORD_DESC" ];
- var whereClause = "1";
- console.log("----- Calling for ascending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC ASC");
- setTimeout( function() {
- console.log("----- Calling descending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC DESC");
- }, 1000);
- }
- catch (err) {
- console.log (err.name +": " + err.message);
- }
-
- </pre>
+try
+{
+ /* globalSQLConsumer and globalReqId should be defined before */
+ /* Increases globalReqId for uniqueness */
+ var columns = ["WORD", "WORD_DESC"];
+ var whereClause = "1";
+ console.log("----- Calling for ascending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC ASC");
+ setTimeout(function()
+ {
+ console.log("----- Calling descending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC DESC");
+ }, 1000);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::removeValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::getValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function getValueSuccessCB(result, id)
- {
- console.log(result.length + ":" + result[0]);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function getValueSuccessCB(result, id)
+{
+ console.log(result.length + ":" + result[0]);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::updateValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a sync info
- var syncInfo = new tizen.SyncInfo("http://example.com/sync", "myId", "myPassword", "MANUAL", "TWO_WAY");
-
- // Syncs both contacts and events
- var contactInfo = new tizen.SyncServiceInfo(true, "CONTACT", "serverContact");
- var eventInfo = new tizen.SyncServiceInfo(true, "EVENT", "serverEvent");
- var serviceInfo = [contactInfo, eventInfo];
-
- // Adds a profile to sync
- var profile = new tizen.SyncProfileInfo("MyProfile", syncInfo, serviceInfo);
- tizen.datasync.add(profile);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a sync info */
+var syncInfo = new tizen.SyncInfo("http://example.com/sync", "myId", "myPassword", "MANUAL", "TWO_WAY");
+
+/* Syncs both contacts and events */
+var contactInfo = new tizen.SyncServiceInfo(true, "CONTACT", "serverContact");
+var eventInfo = new tizen.SyncServiceInfo(true, "EVENT", "serverEvent");
+var serviceInfo = [contactInfo, eventInfo];
+
+/* Adds a profile to sync */
+var profile = new tizen.SyncProfileInfo("MyProfile", syncInfo, serviceInfo);
+tizen.datasync.add(profile);
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Retrieves and updates a profile
- var profile = tizen.datasync.get(profileId);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Retrieves and updates a profile */
+var profile = tizen.datasync.get(profileId);
- profile.profileName = "newProfileName";
+profile.profileName = "newProfileName";
- tizen.datasync.update(profile);
- </pre>
+tizen.datasync.update(profile);
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Removes a profile
- tizen.datasync.remove(profileId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Removes a profile */
+tizen.datasync.remove(profileId);
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::getMaxProfilesNum">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the maximum number of supported profiles on the platform
- var numMaxProfiles = tizen.datasync.getMaxProfilesNum();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the maximum number of supported profiles on the platform */
+var numMaxProfiles = tizen.datasync.getMaxProfilesNum();
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::getProfilesNum">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the present number of profiles on the device
- var numProfiles = tizen.datasync.getProfilesNum();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the present number of profiles on the device */
+var numProfiles = tizen.datasync.getProfilesNum();
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the profile information with the given ID
- var profile = tizen.datasync.get(profileId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the profile information with the given ID */
+var profile = tizen.datasync.get(profileId);
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::getAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets all the profile information
- var profiles = tizen.datasync.getAll();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets all the profile information */
+var profiles = tizen.datasync.getAll();
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::startSync">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var profileId; //profileId obtained from SyncProfileInfo
- var syncCallback = {
- onprogress: function(profileId, serviceType, isFromServer, totalPerType, syncedPerType) {
- console.log('Total: ' + totalPerType + ', synced: ' + syncedPerType + ' for the sync type: ' + serviceType);
- },
- onfailed: function(profileId, error) {
- console.log('Failed with id: ' + profileId + ', error name: ' + error.name);
- }
- };
-
- // Starts the sync operation with the corresponding callbacks
- tizen.datasync.startSync(profileId, syncCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var profileId; /* profileId obtained from SyncProfileInfo */
+var syncCallback =
+{
+ onprogress: function(profileId, serviceType, isFromServer, totalPerType, syncedPerType)
+ {
+ console.log('Total: ' + totalPerType + ', synced: ' + syncedPerType + ' for the sync type: ' + serviceType);
+ },
+ onfailed: function(profileId, error)
+ {
+ console.log('Failed with id: ' + profileId + ', error name: ' + error.name);
+ }
+};
+
+/* Starts the sync operation with the corresponding callbacks */
+tizen.datasync.startSync(profileId, syncCallback);
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::stopSync">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var profileId; //profileId obtained from SyncProfileInfo
- // Stops the ongoing sync operation
- tizen.datasync.stopSync(profileId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var profileId; /* profileId obtained from SyncProfileInfo */
+/* Stops the ongoing sync operation */
+tizen.datasync.stopSync(profileId);
+</pre>
</div>
</dd>
<dt class="method" id="DataSynchronizationManager::getLastSyncStatistics">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var profileId; //profileId obtained from SyncProfileInfo
- // Gets the sync statistics information with the given ID
- var statistics = tizen.datasync.getLastSyncStatistics(profileId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var profileId; /* profileId obtained from SyncProfileInfo */
+/* Gets the sync statistics information with the given ID */
+var statistics = tizen.datasync.getLastSyncStatistics(profileId);
+</pre>
</div>
</dd>
</dl>
2.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var req = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt");
- req.httpHeader["Pragma"] = "no-cache";
- req.httpHeader["Cookie"] = "version=1; Skin=new";
- req.httpHeader["X-Agent"] = "Tizen Sample App";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var req = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt");
+req.httpHeader["Pragma"] = "no-cache";
+req.httpHeader["Cookie"] = "version=1; Skin=new";
+req.httpHeader["X-Agent"] = "Tizen Sample App";
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Check if Download API is supported not on a device.
- var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
- if (download_api_capability === false) {
- console.log("Download API is not supported on this device.");
- return;
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Check whether Download API is supported on a device */
+var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
+if (download_api_capability === false)
+{
+ console.log("Download API is not supported on this device.");
- var listener = {
- onprogress: function(id, receivedSize, totalSize) {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id) {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id) {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, path) {
- console.log('Completed with id: ' + id + ', path: ' + path);
- },
- onfailed: function(id, error) {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
- };
+ return;
+}
- // Starts downloading the file from the Web with the corresponding callbacks.
- var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
- var downloadId = tizen.download.start(downloadRequest, listener);
+var listener =
+{
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, path)
+ {
+ console.log('Completed with id: ' + id + ', path: ' + path);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
+};
- // If you want to download a large file through Wi-Fi,
- var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
- var wifiDownloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
+/* Starts downloading the file from the Web with the corresponding callbacks */
+var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
+var downloadId = tizen.download.start(downloadRequest, listener);
- if (wifi_capability === true) {
- var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
- } else {
- // If you call tizen.download.start(), NotSupportedError will be thrown.
- console.log("This device doesn't support Download API through Wi-Fi.");
- }
+/* If you want to download a large file through Wi-Fi */
+var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
+var wifiDownloadRequest = new tizen.DownloadRequest(
+ "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
- </pre>
+if (wifi_capability === true)
+{
+ var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
+}
+else
+{
+ /* If you call tizen.download.start(), NotSupportedError will be thrown */
+ console.log("This device doesn't support Download API through Wi-Fi.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::cancel">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Cancels the ongoing download operation with the specified ID.
- tizen.download.cancel(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Cancels the ongoing download operation with the specified ID */
+tizen.download.cancel(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::pause">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Pauses the ongoing download operation with the specified ID.
- tizen.download.pause(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Pauses the ongoing download operation with the specified ID */
+tizen.download.pause(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::resume">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Resumes the paused download operation with the specified ID.
- tizen.download.resume(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Resumes the paused download operation with the specified ID */
+tizen.download.resume(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getState">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the state of the download operation with the given ID.
- var state = tizen.download.getState(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the state of the download operation with the given ID */
+var state = tizen.download.getState(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getDownloadRequest">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the download request information with the given ID.
- var downloadRequest = tizen.download.getDownloadRequest(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the download request information with the given ID */
+var downloadRequest = tizen.download.getDownloadRequest(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getMIMEType">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Get the MIME type of the download operation with the given ID.
- var MIMEtype = tizen.download.getMIMEType(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Get the MIME type of the download operation with the given ID */
+var MIMEtype = tizen.download.getMIMEType(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::setListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- onprogress: function(id, receivedSize, totalSize) {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id) {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id) {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, fileName) {
- console.log('Completed with id: ' + id + ', file name: ' + fileName);
- },
- onfailed: function(id, error) {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, fileName)
+ {
+ console.log('Completed with id: ' + id + ', file name: ' + fileName);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
+};
- // Start downloading the html file on the web with the corresponding callbacks.
- var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
- downloadId = tizen.download.start(downloadRequest);
+/* Start downloading the html file on the web with the corresponding callbacks */
+var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
+downloadId = tizen.download.start(downloadRequest);
- // Add the listener.
- tizen.download.setListener(downloadId, listener);
- </pre>
+/* Add the listener */
+tizen.download.setListener(downloadId, listener);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSuccess(exifInfo) {
- console.log("success to get Exif information object");
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occurred: " + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSuccess(exifInfo)
+{
+ console.log("success to get Exif information object");
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
<dt class="method" id="ExifManager::saveExifInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSaveSuccess() {
- console.log("success to save Exif information");
- }
-
- // Defines error callback
- function onSaveError(error) {
- console.log("error occur" + error.name);
- }
-
- // Defines success callback
- function onSuccess(exifInfo) {
- console.log("success to get Exif information object");
- exifInfo.orientation = "ROTATE_90";
- tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occur" + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
-
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSaveSuccess()
+{
+ console.log("success to save Exif information");
+}
+
+/* Defines error callback */
+function onSaveError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+/* Defines success callback */
+function onSuccess(exifInfo)
+{
+ console.log("success to get Exif information object");
+ exifInfo.orientation = "ROTATE_90";
+ tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
<dt class="method" id="ExifManager::getThumbnail">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSuccess(thumbData) {
- console.log("got thumbnail data of JPEG file");
- if (thumbData) {
- var img = new Image();
- img.src = thumbData;
- document.body.appendChild(img);
- }
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occur" + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
-
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSuccess(thumbData)
+{
+ console.log("got thumbnail data of JPEG file");
+ if (thumbData)
+ {
+ var img = new Image();
+ img.src = thumbData;
+ document.body.appendChild(img);
+ }
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
- } catch (err) {
- console.log (err.name +': ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
+}
+catch (err)
+{
+ console.log(err.name + ': ' + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FeedbackManager::stop">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
- tizen.feedback.stop();
- } catch (err) {
- console.log (err.name +': ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
+ tizen.feedback.stop();
+}
+catch (err)
+{
+ console.log(err.name + ': ' + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FeedbackManager::isPatternSupported">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var pattern = "BT_CONNECTED", type = "TYPE_SOUND";
- var isPatternSupported = tizen.feedback.isPatternSupported(pattern, type);
- var isSupported = "";
- if(!isPatternSupported) {
- isSupported = " not";
- }
- console.log("pattern " + pattern + " is" + isSupported + " supported");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var pattern = "BT_CONNECTED", type = "TYPE_SOUND";
+var isPatternSupported = tizen.feedback.isPatternSupported(pattern, type);
+var isSupported = "";
+if (!isPatternSupported)
+{
+ isSupported = " not";
+}
+console.log("pattern " + pattern + " is" + isSupported + " supported");
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> pattern BT_CONNECTED is supported
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- }
-
- var testFile = documentsDir.createFile("test.txt");
-
- if (testFile != null) {
- testFile.openStream(
- "w",
- function(fs) {
- fs.write("HelloWorld");
- fs.close();
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
+</pre>
</div>
</li></ul>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.filesystem.resolve(
- 'images',
- function(dir) {
- console.log("Mount point Name is " + dir.path);
- }, function(e) {
- console.log("Error: " + e.message);
- }, "r"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.filesystem.resolve('images', function(dir)
+{
+ console.log("Mount point Name is " + dir.path);
+}, function(e)
+{
+ console.log("Error: " + e.message);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::getStorage">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onStorage(storage) {
- // Do something
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onStorage(storage)
+{
+ /* Do something */
+}
- function onStorageError(e) {
- console.log("Storage not found!" + e.message);
- }
+function onStorageError(e)
+{
+ console.log("Storage not found!" + e.message);
+}
- tizen.filesystem.getStorage("music", onStorage, onStorageError);
- </pre>
+tizen.filesystem.getStorage("music", onStorage, onStorageError);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::listStorages">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function alertForCorruptedRemovableDrives(storages) {
- for (var i = 0; i < storages.length; i++) {
- if (storages[i].type != "EXTERNAL")
- continue;
- if (storages[i].state == "UNMOUNTABLE")
- console.log("External drive " + storages[i].label + " is corrupted.");
- }
- }
-
- tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function alertForCorruptedRemovableDrives(storages)
+{
+ for (var i = 0; i < storages.length; i++)
+ {
+ if (storages[i].type != "EXTERNAL")
+ continue;
+ if (storages[i].state == "UNMOUNTABLE")
+ console.log("External drive " + storages[i].label + " is corrupted.");
+ }
+}
+
+tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::addStorageStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watchID;
- function onStorageStateChanged(storage) {
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watchID;
+function onStorageStateChanged(storage)
+{
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+}
- watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
- </pre>
+watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::removeStorageStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watchID;
- function onStorageStateChanged(storage) {
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- tizen.filesystem.removeStorageStateChangeListener(watchID);
- }
-
- watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watchID;
+function onStorageStateChanged(storage)
+{
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+ tizen.filesystem.removeStorageStateChangeListener(watchID);
+}
+
+watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- // alerts each name of dir's contents
- console.log(files[i].name);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
-
- // list directory contents
- dir.listFiles(onsuccess, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ /* Alerts each name of dir's contents */
+ console.log(files[i].name);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+
+/* List directory contents */
+dir.listFiles(onsuccess, onerror);
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // list directory contents
- dir.listFiles(onsuccess, onerror);
-
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- // prints the file parent, should contain the
- // same value for all the files in the loop
- console.log("All the files should have the same parent " +
- files[i].parent);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* List directory contents */
+dir.listFiles(onsuccess, onerror);
+
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ /*
+ Prints the file parent, must contain the
+ same value for all the files in the loop
+ */
+ console.log("All the files should have the same parent " +
+ files[i].parent);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+</pre>
</div>
</li>
<li class="attribute" id="File::readOnly">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // lists directory contents
- dir.listFiles(onsuccess, onerror);
-
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].readOnly)
- console.log("Cannot write to file " + files[i].name);
- else
- console.log("Can write to file " + files[i].name);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Lists directory contents */
+dir.listFiles(onsuccess, onerror);
+
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].readOnly)
+ console.log("Cannot write to file " + files[i].name);
+ else
+ console.log("Can write to file " + files[i].name);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+</pre>
</div>
</li>
<li class="attribute" id="File::isFile">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(file.modified); // displays the modification timestamp
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(file.modified); /* Displays the modification timestamp */</pre>
</div>
</li>
<li class="attribute" id="File::path">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(file.path); // should be 'music/' if the file is music/foo.mp3
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(file.path); /* Must be 'music/' if the file is music/foo.mp3 */</pre>
</div>
</li>
<li class="attribute" id="File::name">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // should be foo.mp3 if the file path is music/foo.mp3
- console.log(file.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Must be foo.mp3 if the file path is music/foo.mp3 */
+console.log(file.name);
+</pre>
</div>
</li>
<li class="attribute" id="File::fullPath">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // should be music/track1.mp3 if the file is music/track1.mp3
- console.log(file.fullPath);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Must be music/track1.mp3 if the file is music/track1.mp3 */
+console.log(file.fullPath);
+</pre>
</div>
</li>
<li class="attribute" id="File::fileSize">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // displays the file size
- console.log(file.fileSize);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Displays the file size */
+console.log(file.fileSize);
+</pre>
</div>
</li>
<li class="attribute" id="File::length">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // '3' if the directory contains two files and one sub-directory
- console.log(file.length);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* '3' if the directory contains two files and one sub-directory */
+console.log(file.length);
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file) {
- var audio = new Audio(file.toURI());
- audio.play();
- console.log(file.toURI());
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
+{
+ var audio = new Audio(file.toURI());
+ audio.play();
+ console.log(file.toURI());
+});
+</pre>
</div>
</dd>
<dt class="method" id="File::listFiles">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- console.log("There are " + files.length + " in the selected folder");
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- "documents",
- function(dir) {
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error " + e.message);
- }, "r"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ console.log("There are " + files.length + " in the selected folder");
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve("documents", function(dir)
+{
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error " + e.message);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="File::openStream">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- }
-
- var testFile = documentsDir.createFile("test.txt");
- if (testFile != null) {
- testFile.openStream(
- "w",
- function(fs) {
- fs.write("HelloWorld");
- fs.close();
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir; dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::readAsText">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- if (files[i].isDirectory == false)
- files[i].readAsText(
- function(str) {
- console.log("The file content " + str);
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- var documentsDir;
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ if (files[i].isDirectory == false)
+ {
+ files[i].readAsText(function(str)
+ {
+ console.log("The file content " + str);
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+var documentsDir;
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::copyTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory == false) {
- documentsDir.copyTo(files[i].fullPath,
- "images/backup/" + files[i].name,
- false,
- function() {console.log("file copied");});
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.copyTo(files[i].fullPath,
+ "images/backup/" + files[i].name, false,
+ function() {console.log("file copied");});
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::moveTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory == false) {
- documentsDir.moveTo(files[i].fullPath,
- "images/newFolder/" + files[i].name,
- false,
- function() {console.log("file moved");});
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred during listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.moveTo(files[i].fullPath,
+ "images/newFolder/" + files[i].name, false,
+ function() {console.log("file moved");});
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred during listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::createDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var dir; //Directory object obtained from filesystem API
- var newDir = dir.createDirectory("newDir");
- var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var dir; /* Directory object obtained from filesystem API */
+var newDir = dir.createDirectory("newDir");
+var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
+</pre>
</div>
</dd>
<dt class="method" id="File::createFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var newFile = dir.createFile("newFilePath");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">var newFile = dir.createFile("newFilePath");</pre>
</div>
</dd>
<dt class="method" id="File::resolve">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var file;
- // Resolves helloWorld.doc file that is located in the
- // documents root location
- tizen.filesystem.resolve(
- 'documents',
- function(dir) { file = dir.resolve("helloWorld.doc");},
- function(e) { console.log("Error" + e.message);},
- "rw");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var file;
+/*
+ Resolves helloWorld.doc file that is located in the
+ documents root location
+*/
+tizen.filesystem.resolve('documents', function(dir)
+{
+ file = dir.resolve("helloWorld.doc");
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::deleteDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory) {
- documentsDir.deleteDirectory(
- files[i].fullPath,
- false,
- function() {
- console.log("Directory Deleted");
- }, function(e) {
- console.log("Error" + e.message);
- });
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory)
+ {
+ documentsDir.deleteDirectory(files[i].fullPath, false, function()
+ {
+ console.log("Directory Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::deleteFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (!files[i].isDirectory) {
- documentsDir.deleteFile(
- files[i].fullPath,
- function() {
- console.log("File Deleted");
- }, function(e) {
- console.log("Error" + e.message);
- });
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- var documentsDir;
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (!files[i].isDirectory)
+ {
+ documentsDir.deleteFile(files[i].fullPath, function()
+ {
+ console.log("File Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+var documentsDir;
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess,onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> if (stream.eof) {
- // file has been read completely
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+if (stream.eof)
+{
+ /* File has been read completely */
+}
+</pre>
</div>
</li>
<li class="attribute" id="FileStream::position">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(stream.position); // displays current stream position
- // alters current stream position to the begin of the file,
- // like seek() in C
- stream.position = 0;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(stream.position); /* Displays current stream position */
+/*
+ Alters current stream position to the begin of the file,
+ like seek() in C
+*/
+stream.position = 0;
+</pre>
</div>
</li>
<li class="attribute" id="FileStream::bytesAvailable">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(stream.bytesAvailable); // displays the available bytes to be read
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(stream.bytesAvailable); /* Displays the available bytes to be read */</pre>
</div>
</li>
</ul>
http://tizen.org/privilege/filesystem.read
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> stream.close(); // closes this stream, no subsequent access to stream allowed
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+stream.close(); /* Closes this stream, no subsequent access to stream allowed */
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::read">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var text = stream.read(file.fileSize);
- stream.close();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var text = stream.read(file.fileSize);
+stream.close();
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::readBytes">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // reads up to 256 bytes from the stream
- var raw = stream.readBytes(256);
- for (var i = 0; i < raw.length; i++) {
- // raw[i] contains the i-th byte of the current data chunk
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Reads up to 256 bytes from the stream */
+var raw = stream.readBytes(256);
+for (var i = 0; i < raw.length; i++)
+{
+ /* raw[i] contains the i-th byte of the current data chunk */
+}
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::readBase64">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // reads up to 256 bytes from the stream
- var base64 = stream.readBase64(256);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Reads up to 256 bytes from the stream */
+var base64 = stream.readBase64(256);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::write">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var text = "Hello world";
- stream.write(text);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var text = "Hello world";
+stream.write(text);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::writeBytes">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var bytes = in.readBytes(256);
- // writes the bytes read from in to out
- out.writeBytes(bytes);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var bytes = in.readBytes(256);
+/* Writes the bytes read from in to out */
+out.writeBytes(bytes);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::writeBase64">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var base64 = in.readBase64(256);
- // writes the base64 data read from in to out
- out.writeBase64(base64);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var base64 = in.readBase64(256);
+/* Writes the base64 data read from in to out */
+out.writeBase64(base64);
+</pre>
</div>
</dd>
</dl>
2.3
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> if (!tizen.fmradio.isAntennaConnected) {
- console.log("Please plug in the earphones to listen to the radio");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+if (!tizen.fmradio.isAntennaConnected)
+{
+ console.log("Please plug in the earphones to listen to the radio");
+}
+</pre>
</div>
</li>
<li class="attribute" id="FMRadioManager::mute">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var radioState = tizen.fmradio.state;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var radioState = tizen.fmradio.state;
- if(radioState == "READY") {
- tizen.fmradio.start(87.5);
- }
- // jump to your favorite radio station (95.9MHz) and start playing
- //tizen.fmradio.start(95.9);
- </pre>
+if (radioState == "READY")
+{
+ tizen.fmradio.start(87.5);
+}
+/* Jump to your favorite radio station (95.9MHz) and start playing */
+/* tizen.fmradio.start(95.9); */
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::stop">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var radioState = tizen.fmradio.state;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var radioState = tizen.fmradio.state;
- if(radioState == "PLAYING") {
- tizen.fmradio.stop();
- }
- </pre>
+if (radioState == "PLAYING")
+{
+ tizen.fmradio.stop();
+}
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::seekUp">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var radioState = tizen.fmradio.state;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var radioState = tizen.fmradio.state;
- function successCallback() {
- console.log("The radio find a new frequency successfully");
- }
- function errorCallback(err) {
- console.log("The following error occurred : " + err.name);
- }
+function successCallback()
+{
+ console.log("The radio find a new frequency successfully");
+}
+function errorCallback(err)
+{
+ console.log("The following error occurred: " + err.name);
+}
- if(radioState == "PLAYING") {
- tizen.fmradio.seekUp(successCallback, errorCallback);
- }
- </pre>
+if (radioState == "PLAYING")
+{
+ tizen.fmradio.seekUp(successCallback, errorCallback);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::seekDown">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var radioState = tizen.fmradio.state;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var radioState = tizen.fmradio.state;
- function successCallback() {
- console.log("The radio find a new frequency successfully");
- }
- function errorCallback(err) {
- console.log("The following error occurred : " + err.name);
- }
+function successCallback()
+{
+ console.log("The radio find a new frequency successfully");
+}
+function errorCallback(err)
+{
+ console.log("The following error occurred: " + err.name);
+}
- if(radioState == "PLAYING") {
- tizen.fmradio.seekDown(successCallback, errorCallback);
- }
- </pre>
+if (radioState == "PLAYING")
+{
+ tizen.fmradio.seekDown(successCallback, errorCallback);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::scanStart">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var radioState = tizen.fmradio.state;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var radioState = tizen.fmradio.state;
- var radioScanCallback = {
- onfrequencyfound: function(frequency) {
- console.log("A new frequency found: " + frequency);
- },
- onfinished: function(frequencies) {
- console.log(frequencies.length + "frequencies found!");
- for (var i = 0; i < frequencies.length; i++) {
- console.log(i + ": " + frequencies[i]);
- }
- }
- };
- function errorCallback(err) {
- console.log("The following error occurred : " + err.name);
- }
+var radioScanCallback =
+{
+ onfrequencyfound: function(frequency)
+ {
+ console.log("A new frequency found: " + frequency);
+ },
+ onfinished: function(frequencies)
+ {
+ console.log(frequencies.length + "frequencies found!");
+ for (var i = 0; i < frequencies.length; i++)
+ {
+ console.log(i + ": " + frequencies[i]);
+ }
+ }
+};
+function errorCallback(err)
+{
+ console.log("The following error occurred: " + err.name);
+}
- if(radioState == "READY") {
- tizen.fmradio.scanStart(radioScanCallback, errorCallback);
- }
- </pre>
+if (radioState == "READY")
+{
+ tizen.fmradio.scanStart(radioScanCallback, errorCallback);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::scanStop">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var radioState = tizen.fmradio.state;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var radioState = tizen.fmradio.state;
- function successCallback() {
- console.log("The scanning stops");
- }
- function errorCallback(err) {
- console.log("The following error occurred : " + err.name);
- }
+function successCallback()
+{
+ console.log("The scanning stops");
+}
+function errorCallback(err)
+{
+ console.log("The following error occurred: " + err.name);
+}
- if (radioState == "SCANNING") {
- tizen.fmradio.scanStop(successCallback, errorCallback);
- }
- </pre>
+if (radioState == "SCANNING")
+{
+ tizen.fmradio.scanStop(successCallback, errorCallback);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::setFMRadioInterruptedListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var interruptCallback = {
- oninterrupted: function(reason) {
- console.log(reason);
- },
- oninterruptfinished: function() {
- console.log("The radio interruption finished.");
- }
- };
- tizen.fmradio.setFMRadioInterruptedListener(interruptCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var interruptCallback =
+{
+ oninterrupted: function(reason)
+ {
+ console.log(reason);
+ },
+ oninterruptfinished: function()
+ {
+ console.log("The radio interruption finished.");
+ }
+};
+tizen.fmradio.setFMRadioInterruptedListener(interruptCallback);
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::unsetFMRadioInterruptedListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.fmradio.unsetFMRadioInterruptListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.fmradio.unsetFMRadioInterruptListener();
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::setAntennaChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function antennaCallback(isAntennaConnected) {
- alert("Antenna status has been changed. It is now " + (isAntennaConnected ? "connected" : "disconnected"));
- }
- tizen.fmradio.setAntennaChangeListener(antennaCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function antennaCallback(isAntennaConnected)
+{
+ alert("Antenna status has been changed. It is now " + (isAntennaConnected ? "connected" : "disconnected"));
+}
+tizen.fmradio.setAntennaChangeListener(antennaCallback);
+</pre>
</div>
</dd>
<dt class="method" id="FMRadioManager::unsetAntennaChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When you don't want to detect a change in the antenna status
- tizen.fmradio.unsetAntennaChangeListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* When you don't want to detect a change in the antenna status */
+tizen.fmradio.unsetAntennaChangeListener();
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onchangedCB(sleepInfo) {
- console.log("Sleep status : " + sleepInfo.status);
- console.log("Timestamp : " + sleepInfo.timestamp);
- }
-
- tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onchangedCB(sleepInfo)
+{
+ console.log("Sleep status: " + sleepInfo.status);
+ console.log("Timestamp: " + sleepInfo.timestamp);
+}
+
+tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre> Sleep status : ASLEEP
- Timestamp : 1456735296123
+<span class="title"><p>Output example:</p></span><pre> Sleep status: ASLEEP
+ Timestamp: 1456735296123
</pre>
</div>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccessCB(pedometerInfo) {
- console.log("Step status : " + pedometerInfo.stepStatus);
- console.log("Cumulative total step count : " + pedometerInfo.cumulativeTotalStepCount);
- }
-
- function onerrorCB(error) {
- console.log("Error occurs. name:"+error.name + ", message: "+error.message);
- }
-
- function onchangedCB(pedometerdata) {
- console.log("From now on, you will be notified when the pedometer data changes.");
- // To get the current data information
- tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
- }
-
- tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccessCB(pedometerInfo)
+{
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
+}
+
+function onerrorCB(error)
+{
+ console.log("Error occurs. name:" + error.name + ", message: " + error.message);
+}
+
+function onchangedCB(pedometerdata)
+{
+ console.log("From now on, you will be notified when the pedometer data changes.");
+ /* To get the current data information */
+ tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
+}
+
+tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> From now on, you will be notified when the pedometer data changes.
- Step status : WALKING
- Cumulative total step count : 100
+ Step status: WALKING
+ Cumulative total step count: 100
</pre>
</div>
</dd>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onchangedCB(pedometerInfo) {
- console.log("Step status : " + pedometerInfo.stepStatus);
- console.log("Cumulative total step count : " + pedometerInfo.cumulativeTotalStepCount);
- }
-
- tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onchangedCB(pedometerInfo)
+{
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
+}
+
+tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre> Step status : WALKING
- Cumulative total step count : 100
+<span class="title"><p>Output example:</p></span><pre> Step status: WALKING
+ Cumulative total step count: 100
</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onchangedCB(info) {
- var gpsInfo = info.gpsInfo;
- for (var index = 0; index < gpsInfo.length; index++) {
- console.log("latitude: " + gpsInfo[index].latitude);
- console.log("longitude: " + gpsInfo[index].longitude);
- }
- }
-
- function onerrorCB(error) {
- console.log("Error occurred. Name:" + error.name + ", message: " + error.message);
- }
-
- try {
- tizen.humanactivitymonitor.start("GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000});
- } catch(err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onchangedCB(info)
+{
+ var gpsInfo = info.gpsInfo;
+ for (var index = 0; index < gpsInfo.length; index++)
+ {
+ console.log("latitude: " + gpsInfo[index].latitude);
+ console.log("longitude: " + gpsInfo[index].longitude);
+ }
+}
+
+function onerrorCB(error)
+{
+ console.log("Error occurred. Name:" + error.name + ", message: " + error.message);
+}
+
+try
+{
+ tizen.humanactivitymonitor.start("GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000});
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="HumanActivityMonitorManager::stop">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.humanactivitymonitor.stop("PEDOMETER");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.humanactivitymonitor.stop("PEDOMETER");
+</pre>
</div>
</dd>
<dt class="method" id="HumanActivityMonitorManager::setAccumulativePedometerListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onchangedCB(pedometerInfo) {
- console.log("Step status : " + pedometerInfo.stepStatus);
- console.log("Accumulative total step count : " + pedometerInfo.accumulativeTotalStepCount);
- }
-
- tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onchangedCB(pedometerInfo)
+{
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount);
+}
+
+tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre> Step status : WALKING
- Accumulative total step count : 100
+<span class="title"><p>Output example:</p></span><pre> Step status: WALKING
+ Accumulative total step count: 100
</pre>
</div>
</dd>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
+</pre>
</div>
</dd>
<dt class="method" id="HumanActivityMonitorManager::addActivityRecognitionListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log (error.name +': ' + error.message);
- }
-
- function listener(info) {
- console.log('type: ' + info.type);
- console.log('timestamp: ' + info.timestamp);
- console.log('accuracy: ' + info.accuracy);
- }
-
- try {
- var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
- } catch (error) {
- console.log (error.name +': ' + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error.name + ': ' + error.message);
+}
+
+function listener(info)
+{
+ console.log('type: ' + info.type);
+ console.log('timestamp: ' + info.timestamp);
+ console.log('accuracy: ' + info.accuracy);
+}
+
+try
+{
+ var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
+}
+catch (error)
+{
+ console.log(error.name + ': ' + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> type: WALKING
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listenerId;
-
- function errorCallback(error) {
- console.log (error.name +': ' + error.message);
- }
-
- function listener(info) {
- console.log('type: ' + info.type);
- console.log('timestamp: ' + info.timestamp);
- console.log('accuracy: ' + info.accuracy);
-
- tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback);
- }
-
- try {
- listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
- } catch (error) {
- console.log (error.name +': ' + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listenerId;
+
+function errorCallback(error)
+{
+ console.log(error.name + ': ' + error.message);
+}
+
+function listener(info)
+{
+ console.log('type: ' + info.type);
+ console.log('timestamp: ' + info.timestamp);
+ console.log('accuracy: ' + info.accuracy);
+
+ tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback);
+}
+
+try
+{
+ listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
+}
+catch (error)
+{
+ console.log(error.name + ': ' + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> type: WALKING
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var i, keyCode = {}, supportedKeys;
- supportedKeys = tizen.inputdevice.getSupportedKeys();
- for (i = 0; i < supportedKeys.length; i++) {
- keyCode[supportedKeys[i].name] = supportedKeys[i].code;
- }
- if(keyCode.hasOwnProperty("VolumeUp")) {
- tizen.inputdevice.registerKey("VolumeUp");
- }
- window.addEventListener("keydown", function(keyEvent) {
- // identify the key by the numeric code from the keyEvent
- if(keyEvent.keyCode === keyCode.VolumeUp) {
- console.log("The VOLUME UP was pressed");
- }
- });
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var i, keyCode = {}, supportedKeys;
+supportedKeys = tizen.inputdevice.getSupportedKeys();
+for (i = 0; i < supportedKeys.length; i++)
+{
+ keyCode[supportedKeys[i].name] = supportedKeys[i].code;
+}
+if (keyCode.hasOwnProperty("VolumeUp"))
+{
+ tizen.inputdevice.registerKey("VolumeUp");
+}
+window.addEventListener("keydown", function(keyEvent)
+{
+ /* Identify the key by the numeric code from the keyEvent */
+ if (keyEvent.keyCode === keyCode.VolumeUp)
+ {
+ console.log("The VOLUME UP was pressed");
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="InputDeviceManager::getKey">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var keys = ["VolumeUp", "VolumeDown"], i;
- for (i = 0; i < keys.length; i++) {
- try {
- tizen.inputdevice.registerKey(keys[i]);
- } catch(error) {
- console.log("failed to register " + keys[i] + ": " + error);
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var keys = ["VolumeUp", "VolumeDown"], i;
+for (i = 0; i < keys.length; i++)
+{
+ try
+ {
+ tizen.inputdevice.registerKey(keys[i]);
+ }
+ catch (error)
+ {
+ console.log("failed to register " + keys[i] + ": " + error);
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="InputDeviceManager::unregisterKey">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.inputdevice.unregisterKey("VolumeDown");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.inputdevice.unregisterKey("VolumeDown");
+</pre>
</div>
</dd>
<dt class="method" id="InputDeviceManager::registerKeyBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function successCB() {
- console.log('Registsered successfully');
- }
+function successCB()
+{
+ console.log('Registered successfully');
+}
- var keys = ["VolumeUp", "VolumeDown"];
- tizen.inputdevice.registerKeyBatch(keys, successCB, errorCB);
- </pre>
+var keys = ["VolumeUp", "VolumeDown"];
+tizen.inputdevice.registerKeyBatch(keys, successCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="InputDeviceManager::unregisterKeyBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function successCB()
+{
+ console.log('Unregistsered successfully');
+}
- function successCB() {
- console.log('Unregistsered successfully');
- }
- var keys = ["VolumeUp", "VolumeDown"];
- tizen.inputdevice.unregisterKeyBatch(keys, successCB, errorCB);
- </pre>
+var keys = ["VolumeUp", "VolumeDown"];
+tizen.inputdevice.unregisterKeyBatch(keys, successCB, errorCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
- function onSave() {
- console.log("Successfully saved data");
- }
+function onSave()
+{
+ console.log("Successfully saved data");
+}
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::removeData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onSave() {
-
- // do something
-
- // Dictionary does not require package ID because the
- // application which is calling removeData() saved "data1"
- tizen.keymanager.removeData({
- "name": data_name
- });
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onSave()
+{
+ /* Do something */
+
+ /*
+ Dictionary does not require package ID because the
+ application which is calling removeData() saved "data1"
+ */
+ tizen.keymanager.removeData({"name": data_name});
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- if (aliases.length != 0) {
- // Assuming the application calling removeData() has permission
- // to remove aliases[0]
- var app_data = tizen.keymanager.removeData(aliases[0]);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+if (aliases.length != 0)
+{
+ /*
+ Assuming the application calling removeData() has permission
+ to remove aliases[0]
+ */
+ var app_data = tizen.keymanager.removeData(aliases[0]);
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::getData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onSave() {
- // Dictionary does not require package ID because the
- // application which is calling getData() saved "data1"
- var app_data = tizen.keymanager.getData({
- "name": data_name
- });
- console.log("App data: " + app_data + " was retrieved");
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onSave()
+{
+ /*
+ Dictionary does not require package ID because the
+ application which is calling getData() saved "data1"
+ */
+ var app_data = tizen.keymanager.getData({"name": data_name});
+ console.log("App data: " + app_data + " was retrieved");
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- if (aliases.length != 0) {
- // Assuming the application calling getData() has permission to read
- // aliases[0]
- var app_data = tizen.keymanager.getData(aliases[0]);
- console.log("App data: " + app_data + " was retrieved");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+if (aliases.length != 0)
+{
+ /*
+ Assuming the application calling getData() has permission to read
+ aliases[0]
+ */
+ var app_data = tizen.keymanager.getData(aliases[0]);
+ console.log("App data: " + app_data + " was retrieved");
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::getDataAliasList">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- console.log("aliases: ");
- for (var i = 0; i < aliases.length; i++) {
- console.log("Package ID: " + aliases[i].packageId + ", Name: "
- + aliases[i].name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+console.log("aliases: ");
+for (var i = 0; i < aliases.length; i++)
+{
+ console.log("Package ID: " + aliases[i].packageId + ", Name: "
+ + aliases[i].name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::setPermission">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onPermissionSet() {
- console.log("Successfully set permssion");
- }
-
- function onSave() {
- // Dictionary does not require package ID because an
- // application can only set permission for data which it saved
- tizen.keymanager.setPermission({
- "name": data_name
- }, "9PdoiICQ4c", "READ_REMOVE", onPermissionSet);
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onPermissionSet()
+{
+ console.log("Successfully set permission");
+}
+
+function onSave()
+{
+ /*
+ Dictionary does not require package ID because an
+ application can only set permission for data which it saved
+ */
+ tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- function onPermissionSet() {
- console.log("Successfully set permssion");
- }
-
- if (aliases.length != 0) {
- // Check that the application calling setPermission() saved aliases[0] into
- // the KeyManager
- if (aliases[0].packageId === tizen.package.getPackageInfo().id) {
- tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
- } else {
- console.log("This application did not save aliases[0] into the KeyManager");
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+function onPermissionSet()
+{
+ console.log("Successfully set permssion");
+}
+
+if (aliases.length != 0)
+{
+ /*
+ Check that the application calling setPermission() saved aliases[0] into
+ the KeyManager
+ */
+ if (aliases[0].packageId === tizen.package.getPackageInfo().id)
+ {
+ tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+ }
+ else
+ {
+ console.log("This application did not save aliases[0] into the KeyManager");
+ }
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var mcClient = tizen.mediacontroller.getClient();
- } catch (err) {
- console.log (err.name +': ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var mcClient = tizen.mediacontroller.getClient();
+}
+catch (err)
+{
+ console.log(err.name + ': ' + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerManager::createServer">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var mcServer = tizen.mediacontroller.createServer();
- } catch (err) {
- console.log (err.name +': ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var mcServer = tizen.mediacontroller.createServer();
+}
+catch (err)
+{
+ console.log(err.name + ': ' + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
- mcServer.updatePlaybackState('PLAY');
- console.log('Current playback state is: ' + mcServer.playbackInfo.state);
- </pre>
+mcServer.updatePlaybackState('PLAY');
+console.log('Current playback state is: ' + mcServer.playbackInfo.state);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::updatePlaybackPosition">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
- mcServer.updatePlaybackPosition(164);
- console.log('Current playback position is: ' + mcServer.playbackInfo.position);
- </pre>
+mcServer.updatePlaybackPosition(164);
+console.log('Current playback position is: ' + mcServer.playbackInfo.position);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::updateShuffleMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
- mcServer.updateShuffleMode(true);
- console.log('Current shuffle mode is: ' + mcServer.playbackInfo.shuffleMode);
- </pre>
+mcServer.updateShuffleMode(true);
+console.log('Current shuffle mode is: ' + mcServer.playbackInfo.shuffleMode);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::updateRepeatMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
- mcServer.updateRepeatMode(true);
- console.log('Current repeat mode is: ' + mcServer.playbackInfo.repeatMode);
- </pre>
+mcServer.updateRepeatMode(true);
+console.log('Current repeat mode is: ' + mcServer.playbackInfo.repeatMode);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::updateMetadata">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
- var metadata = mcServer.playbackInfo.metadata;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
+var metadata = mcServer.playbackInfo.metadata;
- metadata.artist = 'Artist Name';
- mcServer.updateMetadata(metadata);
+metadata.artist = 'Artist Name';
+mcServer.updateMetadata(metadata);
- console.log('Current metadata is: ' + JSON.stringify(mcServer.playbackInfo.metadata));
- </pre>
+console.log('Current metadata is: ' + JSON.stringify(mcServer.playbackInfo.metadata));
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::addChangeRequestPlaybackInfoListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcServer = tizen.mediacontroller.createServer();
-
- var playbackRequestListener = {
- onplaybackstaterequest: function(state) {
- console.log('Playback state requested to: ' + state);
- },
- onplaybackpositionrequest: function(position) {
- console.log('Playback position requested to: ' + position);
- },
- onshufflemoderequest: function(mode) {
- console.log('Shuffle mode requested to: ' + mode);
- },
- onrepeatmoderequest: function(mode) {
- console.log('Repeat mode requested to: ' + mode);
- }
- };
-
- // Registers to receive playback info change requests from client.
- watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcServer = tizen.mediacontroller.createServer();
+
+var playbackRequestListener =
+{
+ onplaybackstaterequest: function(state)
+ {
+ console.log('Playback state requested to: ' + state);
+ },
+ onplaybackpositionrequest: function(position)
+ {
+ console.log('Playback position requested to: ' + position);
+ },
+ onshufflemoderequest: function(mode)
+ {
+ console.log('Shuffle mode requested to: ' + mode);
+ },
+ onrepeatmoderequest: function(mode)
+ {
+ console.log('Repeat mode requested to: ' + mode);
+ }
+};
+
+/* Registers to receive playback info change requests from client */
+watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::removeChangeRequestPlaybackInfoListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcServer = tizen.mediacontroller.createServer();
-
- var playbackRequestListener = {
- onplaybackstaterequest: function(state) {
- console.log('Playback state requested to: ' + state);
- },
- onplaybackpositionrequest: function(position) {
- console.log('Playback position requested to: ' + position);
- },
- onshufflemoderequest: function(mode) {
- console.log('Shuffle mode requested to: ' + mode);
- },
- onrepeatmoderequest: function(mode) {
- console.log('Repeat mode requested to: ' + mode);
- }
- };
-
- // Registers to receive playback info change requests.
- watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
-
- // Cancels the watch operation.
- mcServer.removeChangeRequestPlaybackInfoListener(watcherId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcServer = tizen.mediacontroller.createServer();
+
+var playbackRequestListener =
+{
+ onplaybackstaterequest: function(state)
+ {
+ console.log('Playback state requested to: ' + state);
+ },
+ onplaybackpositionrequest: function(position)
+ {
+ console.log('Playback position requested to: ' + position);
+ },
+ onshufflemoderequest: function(mode)
+ {
+ console.log('Shuffle mode requested to: ' + mode);
+ },
+ onrepeatmoderequest: function(mode)
+ {
+ console.log('Repeat mode requested to: ' + mode);
+ }
+};
+
+/* Registers to receive playback info change requests */
+watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
+
+/* Cancels the watch operation */
+mcServer.removeChangeRequestPlaybackInfoListener(watcherId);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::addCommandListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcServer = tizen.mediacontroller.createServer();
- var commandReceiveListener = function(clientName, command, data) {
- console.log('Command ' + command + ' received from: ' + clientName +
- ' with data: ' + JSON.stringify(data));
+var commandReceiveListener = function(clientName, command, data)
+{
+ console.log('Command ' + command + ' received from: ' + clientName +
+ ' with data: ' + JSON.stringify(data));
- var reply = {
- myReply: 'someValue'
- };
+ var reply = {myReply: 'someValue'};
- return reply;
- };
+ return reply;
+};
- // Registers to receive custom commands from client.
- watcherId = mcServer.addCommandListener(commandReceiveListener);
- </pre>
+/* Registers to receive custom commands from client */
+watcherId = mcServer.addCommandListener(commandReceiveListener);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::removeCommandListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcServer = tizen.mediacontroller.createServer();
- var commandReceiveListener = function(clientName, command, data) {
- console.log('Command ' + command + ' received from: ' + clientName +
- ' with data: ' + JSON.stringify(data));
+var commandReceiveListener = function(clientName, command, data)
+{
+ console.log('Command ' + command + ' received from: ' + clientName +
+ ' with data: ' + JSON.stringify(data));
- var reply = {
- myReply: 'someValue'
- };
+ var reply = {myReply: 'someValue'};
- return reply;
- };
+ return reply;
+};
- // Registers to receive custom commands from client.
- watcherId = mcServer.addCommandListener(commandReceiveListener);
+/* Registers to receive custom commands from client */
+watcherId = mcServer.addCommandListener(commandReceiveListener);
- // Cancels the watch operation.
- mcServer.removeCommandListener(watcherId);
- </pre>
+/* Cancels the watch operation */
+mcServer.removeCommandListener(watcherId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Access latest server info
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
- console.log('Latest server name is: ' + mcServerInfo.name +
- ', server state: ' + mcServerInfo.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Access latest server info */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+console.log('Latest server name is: ' + mcServerInfo.name +
+ ', server state: ' + mcServerInfo.name);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- mcServerInfo.sendPlaybackState('STOP', function() {
- console.log('Playback has stopped');
- }, function(e) {
- console.log('Unable to change playback state: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+mcServerInfo.sendPlaybackState('STOP', function()
+{
+ console.log('Playback has stopped');
+}, function(e)
+{
+ console.log('Unable to change playback state: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::sendPlaybackPosition">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- mcServerInfo.sendPlaybackPosition(164, function() {
- console.log('Playback position changed');
- }, function(e) {
- console.log('Unable to change playback position: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+mcServerInfo.sendPlaybackPosition(164, function()
+{
+ console.log('Playback position changed');
+}, function(e)
+{
+ console.log('Unable to change playback position: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::sendShuffleMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- mcServerInfo.sendShuffleMode(true, function() {
- console.log('Shuffle mode changed');
- }, function(e) {
- console.log('Unable to change shuffle mode: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+mcServerInfo.sendShuffleMode(true, function()
+{
+ console.log('Shuffle mode changed');
+}, function(e)
+{
+ console.log('Unable to change shuffle mode: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::sendRepeatMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- mcServerInfo.sendRepeatMode(false, function() {
- console.log('Repeat mode changed');
- }, function(e) {
- console.log('Unable to change repeat mode: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+mcServerInfo.sendRepeatMode(false, function()
+{
+ console.log('Repeat mode changed');
+}, function(e)
+{
+ console.log('Unable to change repeat mode: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::sendCommand">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- var exampleCustomCommandData = {
- myFilter: 'rock'
- };
- mcServerInfo.sendCommand('myPlaylistFilter', exampleCustomCommandData, function(response) {
- console.log('Command executed with result: ' + JSON.stringify(response));
- }, function(e) {
- console.log('Error executing command: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+var exampleCustomCommandData = {myFilter: 'rock'};
+
+mcServerInfo.sendCommand('myPlaylistFilter', exampleCustomCommandData, function(response)
+{
+ console.log('Command executed with result: ' + JSON.stringify(response));
+}, function(e)
+{
+ console.log('Error executing command: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::addServerStatusChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- // Registers to be notified when server status changes.
- watcherId = mcServerInfo.addServerStatusChangeListener(function(status) {
- console.log(mcServerInfo.name + ' server status changed to ' + status);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+/* Registers to be notified when server status changes */
+watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
+{
+ console.log(mcServerInfo.name + ' server status changed to ' + status);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::removeServerStatusChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
- // Registers to be notified when server status changes.
- watcherId = mcServerInfo.addServerStatusChangeListener(function(status) {
- console.log(mcServerInfo.name + ' server status changed to ' + status);
- });
+/* Registers to be notified when server status changes */
+watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
+{
+ console.log(mcServerInfo.name + ' server status changed to ' + status);
+});
- // Cancels the watch operation.
- mcServerInfo.removeServerStatusChangeListener(watcherId);
- </pre>
+/* Cancels the watch operation */
+mcServerInfo.removeServerStatusChangeListener(watcherId);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::addPlaybackInfoChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- var playbackListener = {
- onplaybackchanged: function(state, position) {
- console.log('Current playback state: ' + state);
- console.log('Current playback position: ' + position);
- },
- onshufflemodechanged: function(mode) {
- console.log('Shuffle mode changed to: ' + mode);
- },
- onrepeatmodechanged: function(mode) {
- console.log('Repeat mode changed to: ' + mode);
- },
- onmetadatachanged: function(metadata) {
- console.log('Playback metadata changed: ' + JSON.stringify(metadata));
- }
- };
-
- // Registers to be notified when playback state changes.
- watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+var playbackListener =
+{
+ onplaybackchanged: function(state, position)
+ {
+ console.log('Current playback state: ' + state);
+ console.log('Current playback position: ' + position);
+ },
+ onshufflemodechanged: function(mode)
+ {
+ console.log('Shuffle mode changed to: ' + mode);
+ },
+ onrepeatmodechanged: function(mode)
+ {
+ console.log('Repeat mode changed to: ' + mode);
+ },
+ onmetadatachanged: function(metadata)
+ {
+ console.log('Playback metadata changed: ' + JSON.stringify(metadata));
+ }
+};
+
+/* Registers to be notified when playback state changes */
+watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::removePlaybackInfoChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- // receives playback state changes
- var playbackListener = {
- onplaybackchanged: function(state, position) {
- console.log('Current playback state: ' + state);
- console.log('Current playback position: ' + position);
- },
- onshufflemodechanged: function(mode) {
- console.log('Shuffle mode changed to: ' + mode);
- },
- onrepeatmodechanged: function(mode) {
- console.log('Repeat mode changed to: ' + mode);
- },
- onmetadatachanged: function(metadata) {
- console.log('Playback metadata changed: ' + JSON.stringify(metadata));
- }
- };
-
- // Registers to be notified when playback state changes.
- watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
-
- // Cancels the watch operation.
- mcServerInfo.removePlaybackInfoChangeListener(watcherId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+/* Receives playback state changes */
+var playbackListener =
+{
+ onplaybackchanged: function(state, position)
+ {
+ console.log('Current playback state: ' + state);
+ console.log('Current playback position: ' + position);
+ },
+ onshufflemodechanged: function(mode)
+ {
+ console.log('Shuffle mode changed to: ' + mode);
+ },
+ onrepeatmodechanged: function(mode)
+ {
+ console.log('Repeat mode changed to: ' + mode);
+ },
+ onmetadatachanged: function(metadata)
+ {
+ console.log('Playback metadata changed: ' + JSON.stringify(metadata));
+ }
+};
+
+/* Registers to be notified when playback state changes */
+watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
+
+/* Cancels the watch operation */
+mcServerInfo.removePlaybackInfoChangeListener(watcherId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.mediakey.setMediaKeyEventListener({
- onpressed: function(key) {
- console.log("Pressed key: " + key);
- },
- onreleased: function(key) {
- console.log("Released key: " + key);
- }
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.mediakey.setMediaKeyEventListener(
+{
+ onpressed: function(key)
+ {
+ console.log("Pressed key: " + key);
+ },
+ onreleased: function(key)
+ {
+ console.log("Released key: " + key);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaKeyManager::unsetMediaKeyEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.mediakey.unsetMediaKeyEventListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.mediakey.unsetMediaKeyEventListener();
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the LocalMessagePort instance with the specified message port name
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the LocalMessagePort instance with the specified message port name */
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestTrustedLocalMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the LocalMessagePort instance with the specified message port name
- var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the LocalMessagePort instance with the specified message port name */
+var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestRemoteMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the RemoteMessagePort instance with the specified message port name
- var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the RemoteMessagePort instance with the specified message port name */
+var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestTrustedRemoteMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the RemoteMessagePort instance with the specified message port name.
- var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the RemoteMessagePort instance with the specified message port name */
+var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onreceived(data, remoteMsgPort) {
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onreceived(data, remoteMsgPort)
+{
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+}
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- </pre>
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+</pre>
</div>
</dd>
<dt class="method" id="LocalMessagePort::removeMessagePortListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- // Communication routines of your app...
- localMsgPort.removeMessagePortListener(watchId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+/* Communication routines of your app */
+
+localMsgPort.removeMessagePortListener(watchId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sends string message
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
- localMsgPort.addMessagePortListener(function(items, remoteport) {
- // ...
- if(remoteport !== null) {
- remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
- }
- });
- // stream - FileStream object
- var bytePockets = [], byteCount = 0, i = 0;
- while(byteCount stream.bytesAvailable - 256) {
- bytePockets[i] = stream.readBytes(256);
- byteCount+=256;
- i++;
- }
- bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
-
- var messagePortPockets = [{key: "key1", value: "val1"},
- {key: "key2", value: ["val2", "val3", "val4"]},
- {key: "key3", value: bytePockets[0]},
- {key: "key4", value: bytePockets}];
- remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sends string message */
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
+localMsgPort.addMessagePortListener(function(items, remoteport)
+{
+ /* ... */
+ if (remoteport !== null)
+ {
+ remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
+ }
+});
+/* stream - FileStream object */
+var bytePockets = [], byteCount = 0, i = 0;
+while (byteCount < stream.bytesAvailable - 256)
+{
+ bytePockets[i] = stream.readBytes(256);
+ byteCount+=256;
+ i++;
+}
+bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
+
+var messagePortPockets = [{key: "key1", value: "val1"},
+ {key: "key2", value: ["val2", "val3", "val4"]},
+ {key: "key3", value: bytePockets[0]},
+ {key: "key4", value: bytePockets}];
+remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // MessagePortCallback instance
- function onreceived(data, remoteMsgPort) {
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
- }
-
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* MessagePortCallback instance */
+function onreceived(data, remoteMsgPort)
+{
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+}
+
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback.
- var messageSentCallback = function(recipients) {
- console.log("Message sent successfully to " + recipients.length + " recipients.");
- }
-
- // Defines the error callback.
- function errorCallback(err) {
- console.log(err.name + " error: " + err.message);
- }
-
- function serviceListCB(services) {
- if (services.length > 0) {
- var msg = new tizen.Message("messaging.sms", {plainBody: "Tizen first SMS message."});
- services[0].sendMessage(msg, messageSentCallback, errorCallback);
- }
- }
-
- tizen.messaging.getMessageServices("messaging.sms",
- serviceListCB,
- errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+var messageSentCallback = function(recipients)
+{
+ console.log("Message sent successfully to " + recipients.length + " recipients.");
+}
+
+/* Defines the error callback */
+function errorCallback(err)
+{
+ console.log(err.name + " error: " + err.message);
+}
+
+function serviceListCB(services)
+{
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.sms", {plainBody: "Tizen first SMS message."});
+ services[0].sendMessage(msg, messageSentCallback, errorCallback);
+ }
+}
+
+tizen.messaging.getMessageServices("messaging.sms", serviceListCB, errorCallback);
+</pre>
</div>
<div class="constructors">
<h4 id="Message::constructor">Constructors</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Define the success callback.
- function serviceListCB(services) {
- if (services.length > 0) {
- var msg = new tizen.Message("messaging.email");
- msg.attachments = [new tizen.MessageAttachment("images/myimage.png", "image/png"),
- new tizen.MessageAttachment("documents/mydoc.pdf", "text/pdf")];
- }
- }
-
- tizen.messaging.getMessageServices("messaging.email", serviceListCB);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Define the success callback */
+function serviceListCB(services)
+{
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.email");
+ msg.attachments = [new tizen.MessageAttachment("images/myimage.png", "image/png"),
+ new tizen.MessageAttachment("documents/mydoc.pdf", "text/pdf")];
+ }
+}
+
+tizen.messaging.getMessageServices("messaging.email", serviceListCB);
+</pre>
</div>
</li>
</ul>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback.
- function serviceListCB(services) {
- if (services.length > 0) {
- var msg = new tizen.Message("messaging.email");
- msg.body.htmlBody = "<html><body><img src='myimage.png'></body></html>";
- msg.body.inlineAttachments = [new tizen.MessageAttachment("images/myimage.png")];
- }
- }
-
- tizen.messaging.getMessageServices("messaging.email", serviceListCB);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+function serviceListCB(services)
+{
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.email");
+ msg.body.htmlBody = "<html><body><img src='myimage.png'></body></html>";
+ msg.body.inlineAttachments = [new tizen.MessageAttachment("images/myimage.png")];
+ }
+}
+
+tizen.messaging.getMessageServices("messaging.email", serviceListCB);
+</pre>
</div>
</li>
</ul>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback.
- function serviceListCB(services) {
- if (services.length > 0) {
- var msg = new tizen.Message("messaging.sms");
- }
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot get messaging service " + error.message);
- }
-
- tizen.messaging.getMessageServices("messaging.sms", serviceListCB,
- errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+function serviceListCB(services)
+{
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.sms");
+ }
+}
+
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot get messaging service " + error.message);
+}
+
+tizen.messaging.getMessageServices("messaging.sms", serviceListCB,
+ errorCallback);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot get messaging service " + error.message);
- }
-
- // Defines the success callback.
- function serviceListCB(services) {
- console.log("Found " + services.length + "email services");
- }
-
- tizen.messaging.getMessageServices("messaging.email", serviceListCB,
- errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot get messaging service " + error.message);
+}
+
+/* Defines the success callback */
+function serviceListCB(services)
+{
+ console.log("Found " + services.length + "email services");
+}
+
+tizen.messaging.getMessageServices("messaging.email", serviceListCB,
+ errorCallback);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback.
- function messageSent(recipients) {
- console.log("The SMS has been sent");
- }
-
- // Defines the error callback.
- function messageFailed(error) {
- console.log("The SMS could not be sent " + error.message);
- }
-
- // Defines the service error callback.
- function serviceErrorCB(error) {
- console.log("Cannot get messaging service " + error.message);
- }
-
- // Defines the success callback.
- function serviceListCB(services) {
- if (services.length > 0) {
- // SMS sending example
- var msg = new tizen.Message("messaging.sms", {plainBody:"I will arrive in 10 minutes.",
- to:["+34666666666"]});
- // Sends request
- services[0].sendMessage(msg, messageSent, messageFailed);
- }
- }
-
- tizen.messaging.getMessageServices("messaging.sms",
- serviceListCB,
- serviceErrorCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+function messageSent(recipients)
+{
+ console.log("The SMS has been sent");
+}
+
+/* Defines the error callback */
+function messageFailed(error)
+{
+ console.log("The SMS could not be sent " + error.message);
+}
+
+/* Defines the service error callback */
+function serviceErrorCB(error)
+{
+ console.log("Cannot get messaging service " + error.message);
+}
+
+/* Defines the success callback */
+function serviceListCB(services)
+{
+ if (services.length > 0)
+ {
+ /* SMS sending example */
+ var msg = new tizen.Message("messaging.sms", {plainBody:"I will arrive in 10 minutes.",
+ to:["+34666666666"]});
+ /* Sends request */
+ services[0].sendMessage(msg, messageSent, messageFailed);
+ }
+}
+
+tizen.messaging.getMessageServices("messaging.sms", serviceListCB, serviceErrorCB);
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback
- function messageSent(recipients) {
- for (var i = 0; i < recipients.length; i++) {
- console.log("The SMS has been sent to " + recipients[i]);
- }
- }
-
- // Defines the error callback.
- function messageFailed(error) {
- console.log("The SMS could not be sent " + error.message);
- }
-
- // Defines the success callback.
- function serviceListCB(services) {
- if (services.length > 0) {
- // SMS sending example
- var msg = new tizen.Message("messaging.sms", {plainBody: "I will arrive in 10 minutes.",
- to: ["+34666666666", "+34888888888"]});
- // Sends request
- services[0].sendMessage(msg, messageSent, messageFailed);
- }
- }
- tizen.messaging.getMessageServices("messaging.sms", serviceListCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+function messageSent(recipients)
+{
+ for (var i = 0; i < recipients.length; i++)
+ {
+ console.log("The SMS has been sent to " + recipients[i]);
+ }
+}
+
+/* Defines the error callback */
+function messageFailed(error)
+{
+ console.log("The SMS could not be sent " + error.message);
+}
+
+/* Defines the success callback */
+function serviceListCB(services)
+{
+ if (services.length > 0)
+ {
+ /* SMS sending example */
+ var msg = new tizen.Message("messaging.sms", {plainBody: "I will arrive in 10 minutes.",
+ to: ["+34666666666", "+34888888888"]});
+ /* Sends request */
+ services[0].sendMessage(msg, messageSent, messageFailed);
+ }
+}
+tizen.messaging.getMessageServices("messaging.sms", serviceListCB);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // **********************************************************************************
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+ // **********************************************************************************
// * This sample code works on a device which supports Tizen 2.3 Web Device API. *
// **********************************************************************************
- // To get how many SIM cards are available in a device
- var count = tizen.systeminfo.getCount("SIM");
- console.log("There is(are) " + count + " SIM card(s) available.");
-
- // To send a message via the last SIM
- services[0].sendMessage(msg, messageSent, messageFailed, count);
+/* To get how many SIM cards are available in a device */
+var count = tizen.systeminfo.getCount("SIM");
+console.log("There is(are) " + count + " SIM card(s) available.");
- </pre>
+/* To send a message via the last SIM */
+services[0].sendMessage(msg, messageSent, messageFailed, count);
+</pre>
</div>
</dd>
<dt class="method" id="MessageService::loadMessageBody">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Assumes messaging service is initialized.
- var service;
- // Defines the success body loaded callback.
- function successCallback(message) {
- console.log ("body for message: " + message.subject + "from: " + message.from + "loaded.");
- }
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot load message body" + error.message);
- }
-
- function messageQueryCallback(messages) {
- for (var i = 0; i < messages.length; i++) {
- var message = messages[i];
- if (!message.body.loaded) {
- service.loadMessageBody(message, successCallback, errorCallback);
- }
- }
- }
-
- service.messageStorage.findMessages(new tizen.AttributeFilter("type", "EXACTLY", "messaging.email"), messageQueryCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assumes messaging service is initialized */
+var service;
+/* Defines the success body loaded callback */
+function successCallback(message)
+{
+ console.log("body for message: " + message.subject + "from: " + message.from + "loaded.");
+}
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot load message body" + error.message);
+}
+
+function messageQueryCallback(messages)
+{
+ for (var i = 0; i < messages.length; i++)
+ {
+ var message = messages[i];
+ if (!message.body.loaded)
+ {
+ service.loadMessageBody(message, successCallback, errorCallback);
+ }
+ }
+}
+
+service.messageStorage.findMessages(new tizen.AttributeFilter("type", "EXACTLY", "messaging.email"), messageQueryCallback);
+</pre>
</div>
</dd>
<dt class="method" id="MessageService::loadMessageAttachment">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Assumes messaging service is initialized.
- var service;
- // Defines the success body loaded callback.
- function successCallback(attachment) {
- console.log("attachment" + attachment.id + "is loaded to:" + attachment.filePath);
- }
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot load message attachment" + error.message);
- }
-
- function messagesFoundCB(messages) {
- for (var i = 0; i < messages.length; i++) {
- var message = messages[i];
- if (!message.attachments[0].loaded) {
- service.loadMessageAttachment(message.attachments[0], successCallback, errorCallback);
- }
- }
- }
-
- service.messageStorage.findMessages(new tizen.AttributeFilter("hasAttachment", "EXACTLY", true), messagesFoundCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assumes messaging service is initialized */
+var service;
+/* Defines the success body loaded callback */
+function successCallback(attachment)
+{
+ console.log("attachment" + attachment.id + "is loaded to:" + attachment.filePath);
+}
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot load message attachment" + error.message);
+}
+
+function messagesFoundCB(messages)
+{
+ for (var i = 0; i < messages.length; i++)
+ {
+ var message = messages[i];
+ if (!message.attachments[0].loaded)
+ {
+ service.loadMessageAttachment(message.attachments[0], successCallback, errorCallback);
+ }
+ }
+}
+
+service.messageStorage.findMessages(new tizen.AttributeFilter("hasAttachment", "EXACTLY", true), messagesFoundCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageService::sync">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback.
- function serviceSynced() {
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+function serviceSynced()
+{
console.log("New messages are fetched!");
- }
+}
- // Defines the success callback.
- function servicesListSuccessCB(services) {
+/* Defines the success callback */
+function servicesListSuccessCB(services)
+{
services[0].sync(serviceSynced, null, 30);
- // Subscribes to MessageStorage notification
- }
- tizen.messaging.getMessageServices("messaging.email", servicesListSuccessCB);
- </pre>
+ /* Subscribes to MessageStorage notification */
+}
+tizen.messaging.getMessageServices("messaging.email", servicesListSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageService::syncFolder">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var emailService; // Assumes email service is initialized
- // Defines the error callback.
- function errorCallback(err) {
- console.log(err.name + " error: " + err.message);
- }
- function serviceCallback(services) {
- emailService = services[0];
- var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", emailService.id);
-
- emailService.messageStorage.findFolders(filter, folderQueryCallback);
- }
-
- // Defines the success callback.
- function folderSynced() {
- console.log("New messages are fetched!");
- }
- function folderQueryCallback(folders) {
- console.log(folders.length + " folders(s) found!");
- for (var i = 0; i < folders.length; i++) {
- emailService.syncFolder (folders[i], folderSynced, null, 30);
- }
- }
-
- tizen.messaging.getMessageServices("messaging.email", serviceCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var emailService; /* Assumes email service is initialized */
+/* Defines the error callback */
+function errorCallback(err)
+{
+ console.log(err.name + " error: " + err.message);
+}
+function serviceCallback(services)
+{
+ emailService = services[0];
+ var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", emailService.id);
+
+ emailService.messageStorage.findFolders(filter, folderQueryCallback);
+}
+
+/* Defines the success callback */
+function folderSynced()
+{
+ console.log("New messages are fetched!");
+}
+function folderQueryCallback(folders)
+{
+ console.log(folders.length + " folders(s) found!");
+ for (var i = 0; i < folders.length; i++)
+ {
+ emailService.syncFolder (folders[i], folderSynced, null, 30);
+ }
+}
+
+tizen.messaging.getMessageServices("messaging.email", serviceCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="MessageService::stopSync">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback.
- function successCallback() {
- console.log("Draft message added");
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot add draft message " + error.message);
- }
-
- // Defines the service query success callback.
- function serviceListCB(services) {
- if (services.length > 0) {
- var msg = new tizen.Message("messaging.sms", {plainBody: "Tizen draft SMS message."});
- services[0].messageStorage.addDraftMessage(msg,
- successCallback,
- errorCallback);
- }
- }
- tizen.messaging.getMessageServices("messaging.sms", serviceListCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+function successCallback()
+{
+ console.log("Draft message added");
+}
+
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot add draft message " + error.message);
+}
+
+/* Defines the service query success callback */
+function serviceListCB(services)
+{
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.sms", {plainBody: "Tizen draft SMS message."});
+ services[0].messageStorage.addDraftMessage(msg, successCallback,
+ errorCallback);
+ }
+}
+tizen.messaging.getMessageServices("messaging.sms", serviceListCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::findMessages">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- function messageArrayCB(messages) {
- console.log(messages.length + " message(s) fetched!");
- for (var i = 0; i < messages.length; i++) {
- console.log(i + ". message from " + messages[i].from);
- }
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot query messages" + error.message);
- }
-
- var filter = new tizen.AttributeFilter("from", "CONTAINS", "2593");
- messageStorage.findMessages(filter, messageArrayCB, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+function messageArrayCB(messages)
+{
+ console.log(messages.length + " message(s) fetched!");
+ for (var i = 0; i < messages.length; i++)
+ {
+ console.log(i + ". message from " + messages[i].from);
+ }
+}
+
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot query messages" + error.message);
+}
+
+var filter = new tizen.AttributeFilter("from", "CONTAINS", "2593");
+messageStorage.findMessages(filter, messageArrayCB, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::removeMessages">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback.
- var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- function successCallback() {
- console.log("Messages were deleted");
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot delete messages " + error.message);
- }
-
- function messageArrayCB(messages) {
- if (messages.length > 0) {
- messageStorage.removeMessages(messages, successCallback, errorCallback);
- } else {
- console.log("No messages found");
- }
- }
-
- var filter = new tizen.AttributeFilter("from", "CONTAINS", "2593");
- messageStorage.findMessages(filter, messageArrayCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+function successCallback()
+{
+ console.log("Messages were deleted");
+}
+
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot delete messages " + error.message);
+}
+
+function messageArrayCB(messages)
+{
+ if (messages.length > 0)
+ {
+ messageStorage.removeMessages(messages, successCallback, errorCallback);
+ }
+ else
+ {
+ console.log("No messages found");
+ }
+}
+
+var filter = new tizen.AttributeFilter("from", "CONTAINS", "2593");
+messageStorage.findMessages(filter, messageArrayCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::updateMessages">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
-
- // Defines the success callback.
- function successCallback() {
- console.log("Messages were updated");
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot update messages " + error.message);
- }
-
- function messageArrayCB(messages) {
- if (messages.length > 0) {
- messages[0].isRead = true;
- messageStorage.updateMessages([messages[0]], successCallback, errorCallback);
- } else {
- console.log("No messages found");
- }
- }
-
- var filter = new tizen.AttributeFilter('isRead', 'EXACTLY', false);
- messageStorage.findMessages(filter, messageArrayCB);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+
+/* Defines the success callback */
+function successCallback()
+{
+ console.log("Messages were updated");
+}
+
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot update messages " + error.message);
+}
+
+function messageArrayCB(messages)
+{
+ if (messages.length > 0)
+ {
+ messages[0].isRead = true;
+ messageStorage.updateMessages([messages[0]], successCallback, errorCallback);
+ }
+ else
+ {
+ console.log("No messages found");
+ }
+}
+
+var filter = new tizen.AttributeFilter('isRead', 'EXACTLY', false);
+messageStorage.findMessages(filter, messageArrayCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::findConversations">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- function conversationsArrayCB(conversations) {
- console.log(conversations.length + " conversation(s) found!");
- for (var i = 0; i < conversations.length; i++) {
- console.log(i + ". conversation preview " + conversations[i].preview);
- }
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot query conversations" + error.message);
- }
-
- var filter = new tizen.AttributeFilter('from', 'CONTAINS', '2593');
- messageStorage.findConversations(filter, conversationsArrayCB, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+function conversationsArrayCB(conversations)
+{
+ console.log(conversations.length + " conversation(s) found!");
+ for (var i = 0; i < conversations.length; i++)
+ {
+ console.log(i + ". conversation preview " + conversations[i].preview);
+ }
+}
+
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot query conversations" + error.message);
+}
+
+var filter = new tizen.AttributeFilter('from', 'CONTAINS', '2593');
+messageStorage.findConversations(filter, conversationsArrayCB, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::removeConversations">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- // Defines the success callback.
- function successCallback() {
- console.log("Conversations deleted");
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Cannot delete conversations " + error.message);
- }
-
- function conversationsArrayCB(conversations) {
- if (conversations.length > 0) {
- messageStorage.removeConversations(conversations, successCallback,
- errorCallback);
- } else {
- console.log("No conversations found");
- }
- console.log("Deleted " + conversations.length + " conversation(s)");
- }
-
- // Defines the error callback.
- function queryErrorCB(error) {
- console.log("Cannot query conversations" + error.message);
- }
-
- var filter = new tizen.AttributeFilter('from', 'CONTAINS', '2593');
- messageStorage.findConversations(filter, conversationsArrayCB,
- queryErrorCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+/* Defines the success callback */
+function successCallback()
+{
+ console.log("Conversations deleted");
+}
+
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Cannot delete conversations " + error.message);
+}
+
+function conversationsArrayCB(conversations)
+{
+ if (conversations.length > 0)
+ {
+ messageStorage.removeConversations(conversations, successCallback,
+ errorCallback);
+ }
+ else
+ {
+ console.log("No conversations found");
+ }
+ console.log("Deleted " + conversations.length + " conversation(s)");
+}
+
+/* Defines the error callback */
+function queryErrorCB(error)
+{
+ console.log("Cannot query conversations" + error.message);
+}
+
+var filter = new tizen.AttributeFilter('from', 'CONTAINS', '2593');
+messageStorage.findConversations(filter, conversationsArrayCB, queryErrorCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::findFolders">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- function folderArrayCB(folders) {
- console.log(folders.length + " folders(s) found!");
- for (var i = 0; i < folders.length; i++) {
- console.log(i + ", folder: " + folders[i].name);
- }
- }
- var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", service.id);
- messageStorage.findFolders(filter, folderArrayCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+function folderArrayCB(folders)
+{
+ console.log(folders.length + " folders(s) found!");
+ for (var i = 0; i < folders.length; i++)
+ {
+ console.log(i + ", folder: " + folders[i].name);
+ }
+}
+var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", service.id);
+messageStorage.findFolders(filter, folderArrayCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::addMessagesChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- var messageChangeCallback = {
- messagesupdated: function(messages) {
- console.log(messages.length + " message(s) updated");},
- messagesadded: function(messages) {
- console.log(messages.length + " message(s) added");},
- messagesremoved: function(messages) {
- console.log(messages.length + " message(s) removed");}
- };
-
- messageStorage.addMessagesChangeListener(messageChangeCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+var messageChangeCallback =
+{
+ messagesupdated: function(messages)
+ {
+ console.log(messages.length + " message(s) updated");
+ },
+ messagesadded: function(messages)
+ {
+ console.log(messages.length + " message(s) added");
+ },
+ messagesremoved: function(messages)
+ {
+ console.log(messages.length + " message(s) removed");
+ }
+};
+
+messageStorage.addMessagesChangeListener(messageChangeCallback);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::addConversationsChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- var conversationChangeCB = {
- conversationsupdated: function(conversations) {
- console.log(conversations.length + " conversations(s) updated");},
- conversationsadded: function(conversations) {
- console.log(conversations.length + " conversations(s) added");},
- conversationsremoved: function(conversations) {
- console.log(conversations.length + " conversations(s) removed");}
- };
-
- messageStorage.addConversationsChangeListener(conversationChangeCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+var conversationChangeCB =
+{
+ conversationsupdated: function(conversations)
+ {
+ console.log(conversations.length + " conversations(s) updated");
+ },
+ conversationsadded: function(conversations)
+ {
+ console.log(conversations.length + " conversations(s) added");
+ },
+ conversationsremoved: function(conversations)
+ {
+ console.log(conversations.length + " conversations(s) removed");
+ }
+};
+
+messageStorage.addConversationsChangeListener(conversationChangeCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::addFoldersChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- var folderChangeCB = {
- foldersupdated: function(folders) {
- console.log(folders.length + " folders(s) updated");},
- foldersadded: function(folders) {
- console.log(folders.length + " folders(s) added");},
- foldersremoved: function(folders) {
- console.log(folders.length + " folders(s) removed");}
- };
-
- messageStorage.addFoldersChangeListener(folderChangeCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+var folderChangeCB =
+{
+ foldersupdated: function(folders)
+ {
+ console.log(folders.length + " folders(s) updated");
+ },
+ foldersadded: function(folders)
+ {
+ console.log(folders.length + " folders(s) added");
+ },
+ foldersremoved: function(folders)
+ {
+ console.log(folders.length + " folders(s) removed");
+ }
+};
+
+messageStorage.addFoldersChangeListener(folderChangeCB);
+</pre>
</div>
</dd>
<dt class="method" id="MessageStorage::removeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watchId;
- var service; // Assumes messaging service is initialized
- var messageStorage = service.messageStorage;
- var folderChangeCB = {
- foldersupdated: function(folders) {
- console.log(folders.length + " folders(s) updated. Cancel watching.");
- messageStorage.removeChangeListener(watchId); },
- foldersadded: function(folders) {
- console.log(folders.length + " folders(s) added. Cancel watching.");
- messageStorage.removeChangeListener(watchId); },
- foldersremoved: function(folders) {
- console.log(folders.length + " folders(s) removed. Cancel watching.");
- messageStorage.removeChangeListener(watchId);}
- };
-
- watchId = messageStorage.addFoldersChangeListener(folderChangeCB);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watchId;
+var service; /* Assumes messaging service is initialized */
+var messageStorage = service.messageStorage;
+var folderChangeCB =
+{
+ foldersupdated: function(folders)
+ {
+ console.log(folders.length + " folders(s) updated. Cancel watching.");
+ messageStorage.removeChangeListener(watchId);
+ },
+ foldersadded: function(folders)
+ {
+ console.log(folders.length + " folders(s) added. Cancel watching.");
+ messageStorage.removeChangeListener(watchId);
+ },
+ foldersremoved: function(folders)
+ {
+ console.log(folders.length + " folders(s) removed. Cancel watching.");
+ messageStorage.removeChangeListener(watchId)
+ }
+};
+
+watchId = messageStorage.addFoldersChangeListener(folderChangeCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var statuscb = {
- onsuccess: function() { console.log("onsuccess func is called"); },
- ondisconnected: function() { console.log("ondisconnected func is called"); }
- };
- function ecb(e) { console.log("error callback is called : " + e.message + " : " + e.code); }
- tizen.networkbearerselection.requestRouteToHost("CELLULAR", "www.tizen.org", statuscb, ecb);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var statuscb =
+{
+ onsuccess: function() {console.log("onsuccess func is called");},
+ ondisconnected: function() {console.log("ondisconnected func is called");}
+};
+function ecb(e) {console.log("error callback is called: " + e.message + ": " + e.code);}
+
+tizen.networkbearerselection.requestRouteToHost("CELLULAR", "www.tizen.org", statuscb, ecb);
+</pre>
</div>
</dd>
<dt class="method" id="NetworkBearerSelection::releaseRouteToHost">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function scb() { console.log("success callback is called"); }
- function ecb(e) { console.log("error callback is called : " + e.message + " : " + e.code); }
- var statuscb = {
- onsuccess: function() {
- console.log("onsuccess func is called");
- tizen.networkbearerselection.releaseRouteToHost("CELLULAR", "www.google.com", scb, ecb);
- },
- ondisconnected: function() { console.log("ondisconnected func is called"); }
- };
- tizen.networkbearerselection.requestRouteToHost("CELLULAR", "www.google.com", statuscb, ecb);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function scb() {console.log("success callback is called");}
+function ecb(e) {console.log("error callback is called: " + e.message + ": " + e.code);}
+var statuscb =
+{
+ onsuccess: function()
+ {
+ console.log("onsuccess func is called");
+ tizen.networkbearerselection.releaseRouteToHost("CELLULAR", "www.google.com", scb, ecb);
+ },
+ ondisconnected: function() {console.log("ondisconnected func is called");}
+};
+tizen.networkbearerselection.requestRouteToHost("CELLULAR", "www.google.com", statuscb, ecb);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter = tizen.nfc.getDefaultAdapter();
- } catch (err) {
- console.log(err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter = tizen.nfc.getDefaultAdapter();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCManager::setExclusiveMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.nfc.setExclusiveMode(true) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.nfc.setExclusiveMode(true);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gNfcAdapter;
- var onPowerOn = function(){ // Called when NFC adapter is powered on
- try {
- console.log("Power on succeed");
- // Implement NFC communication routines ...
- gNfcAdapter.setPowered(
- false, // Disable NFC adapter
- function () {console.log("Power off succeed"); }, // Handle success
- function () {console.log("Power off failed"); }); // Handle failure
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- };
- try {
- gNfcAdapter = tizen.nfc.getDefaultAdapter();
- if (!gNfcAdapter.powered) {
- gNfcAdapter.setPowered(
- true, // Enable NFC adapter
- onPowerOn, // Handle success
- function () {console.log("Power on failed")}); // Handle failure
- } else {
- onPowerOn();
- }
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gNfcAdapter;
+var onPowerOn = function()
+{
+ /* Called when NFC adapter is powered on */
+ try
+ {
+ console.log("Power on succeed");
+ /* Implement NFC communication routines */
+ gNfcAdapter.setPowered(false, /* Disable NFC adapter */
+ function() {console.log("Power off succeed");}, /* Handle success */
+ function() {console.log("Power off failed");}); /* Handle failure */
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+try
+{
+ gNfcAdapter = tizen.nfc.getDefaultAdapter();
+ if (!gNfcAdapter.powered)
+ {
+ gNfcAdapter.setPowered(true, /* Enable NFC adapter */
+ onPowerOn, /* Handle success */
+ function() {console.log("Power on failed")}); /* Handle failure */
+ }
+ else
+ {
+ onPowerOn();
+ }
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::setTagListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
- var onSuccessCB = {onattach : function(nfcTag) {
- console.log("NFC Tag's type is " + nfcTag.type);
- }, ondetach : function() {
- console.log("NFC Tag is detached");
- }};
- adapter.setTagListener(onSuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+var onSuccessCB =
+{
+ onattach: function(nfcTag)
+ {
+ console.log("NFC Tag's type is " + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ console.log("NFC Tag is detached");
+ }
+};
+adapter.setTagListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::setPeerListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
- var onSuccessCB = {onattach : function(nfcPeer) {
- console.log("NFC Target is detected");
- }, ondetach : function() {
- console.log("NFC Target is detached");
- }};
- adapter.setPeerListener(onSuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+var onSuccessCB =
+{
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
+};
+adapter.setPeerListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::unsetTagListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
-
- // Receives NFCTag
- var onSuccessCB = {
- onattach : function(nfcTag) {
- console.log("The attached NFC tag's type is " + nfcTag.type);
- },
- ondetach : function() {
- console.log("NFC tag is detached.");
-
- // Unregister the listener when the NFC tag is detached.
- adapter.unsetTagListener();
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+
+/* Receives NFCTag */
+var onSuccessCB =
+{
+ onattach: function(nfcTag)
+ {
+ console.log("The attached NFC tag's type is " + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ console.log("NFC tag is detached.");
+
+ /* Unregister the listener when the NFC tag is detached */
+ adapter.unsetTagListener();
+ }
+};
- // Registers to be notified when NFC tag is detected.
- adapter.setTagListener(onSuccessCB);
- </pre>
+/* Registers to be notified when NFC tag is detected */
+adapter.setTagListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::unsetPeerListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
-
- // Receives an NFC peer.
- var onSuccessCB = {
- onattach : function(nfcPeer) {
- console.log("NFC peer target is attached.");
- },
- ondetach : function() {
- console.log("NFC peer target is detached.");
-
- // Unregisters the listener when NFC peer target is detached.
- adapter.unsetPeerListener();
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+
+/* Receives an NFC peer */
+var onSuccessCB =
+{
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC peer target is attached.");
+ },
+ ondetach: function()
+ {
+ console.log("NFC peer target is detached.");
+
+ /* Unregisters the listener when NFC peer target is detached */
+ adapter.unsetPeerListener();
+ }
+};
- // Registers to be notified when NFC peer target is detected.
- adapter.setPeerListener(onSuccessCB);
- </pre>
+/* Registers to be notified when NFC peer target is detected */
+adapter.setPeerListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::addCardEmulationModeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var onSuccessCB = function(mode) {
- console.log("The card emulation mode is " + mode);
- };
- var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onSuccessCB = function(mode)
+ {
+ console.log("The card emulation mode is " + mode);
+ };
+ var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::removeCardEmulationModeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.removeCardEmulationModeChangeListener(listenerId) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.removeCardEmulationModeChangeListener(listenerId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::addTransactionEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data){console.log("transaction event occurs");}) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data) {console.log("transaction event occurs");});
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::removeTransactionEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.removeTransactionEventListener(listenerId) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.removeTransactionEventListener(listenerId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::addActiveSecureElementChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var onSuccessCB = function(seType) {
- console.log("Active secure element is " + seType);
- };
- var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onSuccessCB = function(seType)
+ {
+ console.log("Active secure element is " + seType);
+ };
+ var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::removeActiveSecureElementChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.removeActiveSecureElementChangeListener(listenerId) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.removeActiveSecureElementChangeListener(listenerId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::getCachedMessage">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the cached message
- var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the cached message */
+var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::setExclusiveModeForTransaction">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.setExclusiveModeForTransaction(true) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.setExclusiveModeForTransaction(true);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::addHCEEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var onDetectedCB = function(event_data) {
- console.log("HCE event type is " + event_data.eventType);
- console.log("APDU is " + event_data.apdu);
- };
- var listenerId = adapter.addHCEEventListener(onDetectedCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onDetectedCB = function(event_data)
+ {
+ console.log("HCE event type is " + event_data.eventType);
+ console.log("APDU is " + event_data.apdu);
+ };
+ var listenerId = adapter.addHCEEventListener(onDetectedCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::removeHCEEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.removeHCEEventListener(listenerId) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.removeHCEEventListener(listenerId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::sendHostAPDUResponse">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var successCB = function() {
- console.log("Sending APDU reponse was successful.");
- };
-
- var errorCB = function() {
- console.log("Sending APDU reponse failed.");
- };
-
- var classOfInstruction = 0x00; // No SM or no SM indication
- var instructionCode = 0xA4; //Select File
- var firstParam = 0x04; //Direct selection by DF name
- var secondParam = 0x00; // First record
- var dataFieldLength = 0x03; // Variable length 1 or 3 bytes
- var bytes = [ 0x20, 0x21, 0x22]; // Variable length equal to dataFieldLength
- var maxBytesExpected = 0x02; // Maximum bytes in answer
-
- var apdu_response= [ classOfInstruction, instructionCode, firstParam, secondParam] + bytes + [ maxBytesExpected ]; //set apdu response.
- adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var successCB = function()
+ {
+ console.log("Sending APDU response was successful.");
+ };
+
+ var errorCB = function()
+ {
+ console.log("Sending APDU response failed.");
+ };
+
+ var classOfInstruction = 0x00; /* No SM or no SM indication */
+ var instructionCode = 0xA4; /* Select File */
+ var firstParam = 0x04; /* Direct selection by DF name */
+ var secondParam = 0x00; /* First record */
+ var dataFieldLength = 0x03; /* Variable length 1 or 3 bytes */
+ var bytes = [ 0x20, 0x21, 0x22]; /* Variable length equal to dataFieldLength */
+ var maxBytesExpected = 0x02; /* Maximum bytes in answer */
+
+ var apdu_response = [classOfInstruction, instructionCode, firstParam, secondParam] + bytes + [maxBytesExpected]; /* Set apdu response */
+ adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::isActivatedHandlerForAID">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var aid = "ABC0012345";
- var isActiveHandler = adapter.isActivatedHandlerForAID("HCE", aid);
- if(isActiveHandler){
- console.log("current application is activated handler for the AID");
- }
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var aid = "ABC0012345";
+ var isActiveHandler = adapter.isActivatedHandlerForAID("HCE", aid);
+ if (isActiveHandler)
+ {
+ console.log("current application is activated handler for the AID");
+ }
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::isActivatedHandlerForCategory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var isActiveHandler = adapter.isActivatedHandlerForCategory("ESE", "PAYMENT") ;
- if(isActiveHandler){
- console.log("current application is activated handler for the category");
- }
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var isActiveHandler = adapter.isActivatedHandlerForCategory("ESE", "PAYMENT");
+ if (isActiveHandler)
+ {
+ console.log("current application is activated handler for the category");
+ }
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::registerAID">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var aid = "ABC0012345";
- adapter.registerAID("HCE", aid, "PAYMENT") ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var aid = "ABC0012345";
+ adapter.registerAID("HCE", aid, "PAYMENT");
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::unregisterAID">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var aid = "ABC0012345";
- adapter.unregisterAID("HCE", aid, "PAYMENT") ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var aid = "ABC0012345";
+ adapter.unregisterAID("HCE", aid, "PAYMENT");
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::getAIDsForCategory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var successCB = function(aids) {
- var arrayLength = aids.length;
- for (var i = 0; i arrayLength; i++) {
- console.log("Get AID category was successful.");
- console.log("AID type is " + aids[i].type);
- console.log("AID is " + aids[i].aid);
- console.log("AID isReadOnly is " + aids[i].readOnly);
- }
- };
-
- var errorCB = function() {
- console.log("Get AID category failed.");
- };
-
- adapter.getAIDsForCategory("HCE", "PAYMENT", successCB, errorCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var successCB = function(aids)
+ {
+ var arrayLength = aids.length;
+ for (var i = 0; i arrayLength; i++)
+ {
+ console.log("Get AID category was successful.");
+ console.log("AID type is " + aids[i].type);
+ console.log("AID is " + aids[i].aid);
+ console.log("AID isReadOnly is " + aids[i].readOnly);
+ }
+ };
+
+ var errorCB = function()
+ {
+ console.log("Get AID category failed.");
+ };
+
+ adapter.getAIDsForCategory("HCE", "PAYMENT", successCB, errorCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
- var onSuccessCB = {onattach : function(nfcTag) {
- console.log("NFC Tag's type is " + nfcTag.type);
- for(var i in nfcTag.properties) {
- console.log("key:" + i + " value:" + nfcTag.properties[i]);
- }
- }, ondetach : function() {
- console.log("NFC Tag is detached");
- }};
- adapter.setTagListener(onSuccessCB);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+var onSuccessCB =
+{
+ onattach: function(nfcTag)
+ {
+ console.log("NFC Tag's type is " + nfcTag.type);
+ for (var i in nfcTag.properties)
+ {
+ console.log("key:" + i + " value:" + nfcTag.properties[i]);
+ }
+ },
+ ondetach: function()
+ {
+ console.log("NFC Tag is detached");
+ }
+};
+adapter.setTagListener(onSuccessCB);
+</pre>
</div>
</li>
<li class="attribute" id="NFCTag::isConnected">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var successCB = function(ndefMessage) {
- console.log("Message read was successful.");
- for( var i = 0; i ndefMessage.recordCount; ++i){
- console.log("Message record " + i + "tnf: " + ndefMessage.records[i].tnf);
- console.log("Message record " + i + "tnf: " + ndefMessage.records[i].tnf);
- console.log("Message record type " + ndefMessage.records[i].type.toString());
- ...
- }
- };
-
- var errorCB = function() {
- console.log("Message read failed.");
- };
-
- nfcTag.readNDEF(successCB, errorCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var successCB = function(ndefMessage)
+ {
+ console.log("Message read was successful.");
+ for (var i = 0; i < ndefMessage.recordCount; ++i)
+ {
+ console.log("Message record " + i + "tnf: " + ndefMessage.records[i].tnf);
+ console.log("Message record " + i + "tnf: " + ndefMessage.records[i].tnf);
+ console.log("Message record type " + ndefMessage.records[i].type.toString());
+ }
+ };
+
+ var errorCB = function()
+ {
+ console.log("Message read failed.");
+ };
+
+ nfcTag.readNDEF(successCB, errorCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCTag::writeNDEF">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var successCB = function() {
- console.log("Message write was successful.");
- }
- };
-
- var errorCB = function() {
- console.log("Message write failed.");
- };
-
-
- var record = new tizen.NDEFRecordText("Hi!", "en-GB");
- var message = new tizen.NDEFMessage([record]);
-
- nfcTag.writeNDEF(message, successCB, errorCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var successCB = function()
+ {
+ console.log("Message write was successful.");
+ };
+
+ var errorCB = function()
+ {
+ console.log("Message write failed.");
+ };
+
+ var record = new tizen.NDEFRecordText("Hi!", "en-GB");
+ var message = new tizen.NDEFMessage([record]);
+
+ nfcTag.writeNDEF(message, successCB, errorCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCTag::transceive">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var successCB = function(data) {
- console.log("Message write was successful.");
- console.log("Response is " + data.toString());
- }
- };
-
- var errorCB = function() {
- console.log("Message write failed.");
- };
-
- var message = [0x30, 0x00, 0x02, 0xa8]; // READ command for MIFARE tags
-
- nfcTag.transceive(message, successCB, errorCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var successCB = function(data)
+ {
+ console.log("Message write was successful.");
+ console.log("Response is " + data.toString());
+ };
+
+ var errorCB = function()
+ {
+ console.log("Message write failed.");
+ };
+
+ var message = [0x30, 0x00, 0x02, 0xa8]; /* READ command for MIFARE tags */
+
+ nfcTag.transceive(message, successCB, errorCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
-
- // Receives NFCPeer
- var onSuccessCB = {onattach : function(nfcPeer) {
- console.log("NFC Target is detected");
- nfcPeer.setReceiveNDEFListener(
- function(message){
- console.log("Receive message");
- });
- }, ondetach : function() {
- console.log("NFC Target is detached");
- }};
-
- adapter.setPeerListener(onSuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+
+/* Receives NFCPeer */
+var onSuccessCB =
+{
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ nfcPeer.setReceiveNDEFListener(function(message)
+ {
+ console.log("Receive message");
+ });
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
+};
+
+adapter.setPeerListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCPeer::unsetReceiveNDEFListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
- var onSuccessCB = {onattach : function(nfcPeer) {
- console.log("NFC Target is detected");
- nfcPeer.setReceiveNDEFListener(
- function(message){
- console.log("Receive message");
- nfcPeer.unsetReceiveNDEFListener();
- });
- }, ondetach : function() {
- console.log("NFC Target is detached");
- }};
- }
-
- adapter.setPeerListener(onSuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+var onSuccessCB =
+{
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ nfcPeer.setReceiveNDEFListener(function(message)
+ {
+ console.log("Receive message");
+ nfcPeer.unsetReceiveNDEFListener();
+ });
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
+};
+
+adapter.setPeerListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCPeer::sendNDEF">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- peerListener = {
- onattach: function (peer) {
- var record = new tizen.NDEFRecordText("sendNDEF-test", 'en-US');
- var message = new tizen.NDEFMessage([record]);
- returned = peer.sendNDEF(ndefMessage);
- },
- ondetach: t.step_func(function () {
- adapter.unsetPeerListener();
- }
- };
-
- adapter.setPeerListener(peerListener);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ peerListener =
+ {
+ onattach: function(peer)
+ {
+ var record = new tizen.NDEFRecordText("sendNDEF-test", 'en-US');
+ var message = new tizen.NDEFMessage([record]);
+ returned = peer.sendNDEF(ndefMessage);
+ },
+ ondetach: t.step_func(function()
+ {
+ adapter.unsetPeerListener();
+ }
+ };
+
+ adapter.setPeerListener(peerListener);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var record = new tizen.NDEFRecordText("Hi!", "en-GB");
- var tempMessage = new tizen.NDEFMessage([record]);
- var rawData = tempMessage.toByte();
-
- var message = new tizen.NDEFMessage(rawData);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var record = new tizen.NDEFRecordText("Hi!", "en-GB");
+ var tempMessage = new tizen.NDEFMessage([record]);
+ var rawData = tempMessage.toByte();
+
+ var message = new tizen.NDEFMessage(rawData);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
<div class="constructors">
<h4 id="NDEFMessage::constructor">Constructors</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- // prepare two NDEFRecords:
- var myRecordURI = new tizen.NDEFRecordURI("https://www.tizen.org/");
- var myRecordTextPlain = new tizen.NDEFRecordMedia("text/plain", [116, 105, 122, 101, 110]);
-
- // create a NDEFMessage composed of two NDEFRecords:
- var myMessage = new NDEFMessage([myRecordURI, myRecordTextPlain]);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Prepare two NDEFRecords */
+ var myRecordURI = new tizen.NDEFRecordURI("https://www.tizen.org/");
+ var myRecordTextPlain = new tizen.NDEFRecordMedia("text/plain", [116, 105, 122, 101, 110]);
+
+ /* Create a NDEFMessage composed of two NDEFRecords */
+ var myMessage = new NDEFMessage([myRecordURI, myRecordTextPlain]);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the cached message.
- var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
- var raw = cachedMessage.toByte();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the cached message */
+var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
+var raw = cachedMessage.toByte();
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var recordBytes = [217, 1, 2, 3, 202, 219, 218, 217, 240, 241];
- var record = new tizen.NDEFRecord(recordBytes);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var recordBytes = [217, 1, 2, 3, 202, 219, 218, 217, 240, 241];
+ var record = new tizen.NDEFRecord(recordBytes);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var type = new Array(255),
- var payload = new Array(256),
- var recordId = [155, 150],
- var newRecord = new tizen.NDEFRecord(tizen.nfc.NFC_RECORD_TNF_UNKNOWN, type, payload, recordId);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var type = new Array(255),
+ var payload = new Array(256),
+ var recordId = [155, 150],
+ var newRecord = new tizen.NDEFRecord(tizen.nfc.NFC_RECORD_TNF_UNKNOWN, type, payload, recordId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
<div class="constructors">
<h4 id="NDEFRecord::constructor">Constructors</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a new NDEF record.
- var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
- var payload = newRecord.payload;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a new NDEF record */
+var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
+var payload = newRecord.payload;
+</pre>
</div>
</li>
</ul>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var newRecord = new tizen.NDEFRecordText("Tizen", "en-US", "UTF8");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var newRecord = new tizen.NDEFRecordText("Tizen", "en-US", "UTF8");
+</pre>
</div>
</li>
</ul>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a new NDEF record.
- var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
- var payload = newRecord.payload;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a new NDEF record */
+var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
+var payload = newRecord.payload;
+</pre>
</div>
</li></ul>
</div>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myData = [116, 105, 122, 101, 110];
- var newRecord = new tizen.NDEFRecordMedia("text/plain", myData);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myData = [116, 105, 122, 101, 110];
+var newRecord = new tizen.NDEFRecordMedia("text/plain", myData);
+</pre>
</div>
</li></ul>
</div>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var onSuccessCB = {
- onattach: function (nfcTag){
- console.log("Successfully detected nfcTag type:" + nfcTag.type);
- }
- }
-
- var adapter = tizen.nfc.getDefaultAdapter();
- adapter.setTagListener(onSuccessCB);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onSuccessCB =
+ {
+ onattach: function(nfcTag)
+ {
+ console.log("Successfully detected nfcTag type:" + nfcTag.type);
+ }
+ }
+
+ var adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setTagListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCTagDetectCallback::ondetach">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter;
- var onSuccessCB = {
- onattach: function (nfcTag){
- console.log("Successfully detected nfcTag type:" + nfcTag.type);
- },
- ondetach: function() {
- adapter.unsetTagListener();
- }
- }
-
- adapter = tizen.nfc.getDefaultAdapter();
- adapter.setTagListener(onSuccessCB);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter;
+ var onSuccessCB =
+ {
+ onattach: function(nfcTag)
+ {
+ console.log("Successfully detected nfcTag type:" + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ adapter.unsetTagListener();
+ }
+ }
+
+ adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setTagListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter;
- var onSuccessCB = {
- onattach: function (nfcPeer){
- console.log("Successfully detected nfcPeer :" + nfcPeer.isConnected);
- }
- }
-
- adapter = tizen.nfc.getDefaultAdapter();
- adapter.setPeerListener(onSuccessCB);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter;
+ var onSuccessCB =
+ {
+ onattach: function(nfcPeer)
+ {
+ console.log("Successfully detected nfcPeer:" + nfcPeer.isConnected);
+ }
+ }
+
+ adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setPeerListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCPeerDetectCallback::ondetach">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter;
- var onSuccessCB = {
- onattach: function (nfcPeer){
- console.log("Successfully detected nfcPeer :" + nfcPeer.isConnected);
- },
- ondetach: function() {
- adapter.unsetPeerListener();
- }
- }
-
- adapter = tizen.nfc.getDefaultAdapter();
- adapter.setPeerListener(onSuccessCB);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter;
+ var onSuccessCB =
+ {
+ onattach: function(nfcPeer)
+ {
+ console.log("Successfully detected nfcPeer:" + nfcPeer.isConnected);
+ },
+ ondetach: function()
+ {
+ adapter.unsetPeerListener();
+ }
+ }
+
+ adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setPeerListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter;
-
- var readCallback = function (ndefMessage) {
- console.log("NDEFMessageReadCallback called successfully");
- }
-
- var tagListener = {
- onattach: function (nfcTag){
- var result = nfcTag.readNDEF(readCallback);
- }
- }
-
- adapter = tizen.nfc.getDefaultAdapter();
- adapter.setTagListener(tagListener);
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter;
+
+ var readCallback = function(ndefMessage)
+ {
+ console.log("NDEFMessageReadCallback called successfully");
+ }
+
+ var tagListener =
+ {
+ onattach: function(nfcTag)
+ {
+ var result = nfcTag.readNDEF(readCallback);
+ }
+ }
+
+ adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setTagListener(tagListener);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var successCB = function(data) {
- console.log("ByteArraySuccessCallback called successfully.");
- }
- };
-
- var message = [0x30, 0x00, 0x02, 0xa8]; // READ command for MIFARE tags
-
- nfcTag.transceive(message, successCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var successCB = function(data)
+ {
+ console.log("ByteArraySuccessCallback called successfully.");
+ };
+
+ var message = [0x30, 0x00, 0x02, 0xa8]; /* READ command for MIFARE tags */
+
+ nfcTag.transceive(message, successCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var onSuccessCB = function(mode) {
- console.log("CardEmulationModeChangeCallback called successfully");
- };
-
- var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onSuccessCB = function(mode)
+ {
+ console.log("CardEmulationModeChangeCallback called successfully");
+ };
+
+ var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var onSuccessCB = function(aid, data) {
- console.log("TransactionEventCallback called successfully");
- };
-
- var listenerId = adapter.addTransactionEventListener("UICC", onSuccessCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onSuccessCB = function(aid, data)
+ {
+ console.log("TransactionEventCallback called successfully");
+ };
+
+ var listenerId = adapter.addTransactionEventListener("UICC", onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var onSuccessCB = function(seType) {
- console.log("ActiveSecureElementChangeCallback called successfully");
- };
-
- var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onSuccessCB = function(seType)
+ {
+ console.log("ActiveSecureElementChangeCallback called successfully");
+ };
+
+ var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var onDetectedCB = function(event_data) {
- console.log("HCEEventReceiveCallback called successfully");
- };
-
- var listenerId = adapter.addHCEEventListener(onDetectedCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onDetectedCB = function(event_data)
+ {
+ console.log("HCEEventReceiveCallback called successfully");
+ };
+
+ var listenerId = adapter.addHCEEventListener(onDetectedCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var successCB = function(aids) {
- console.log("AIDArraySuccessCallback called successfully");
- };
-
- adapter.getAIDsForCategory("HCE", "PAYMENT", successCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var successCB = function(aids)
+ {
+ console.log("AIDArraySuccessCallback called successfully");
+ };
+
+ adapter.getAIDsForCategory("HCE", "PAYMENT", successCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/create_content",
- null,
- "image/jpg",
- null);
- var notificationDict = {
- content : "This is a simple notification.",
- iconPath : "images/image1.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true,
- appControl : appControl};
-
- var notification = new tizen.StatusNotification("SIMPLE",
- "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
+ null, "image/jpg", null);
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appControl: appControl
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Uses a variable for the previously posted notification.
- notification.content = "My notification";
- tizen.notification.update(notification);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Uses a variable for the previously posted notification */
+ notification.content = "My notification";
+ tizen.notification.update(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Uses a variable for the previously posted notification.
- tizen.notification.remove(notification.id);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Uses a variable for the previously posted notification */
+ tizen.notification.remove(notification.id);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::removeAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.notification.removeAll();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.notification.removeAll();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Uses a variable for the previously posted notification
- // Saves the notification ID for future use
- var myId = notification.id;
-
- var myNotification = tizen.notification.get(myId);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Uses a variable for the previously posted notification */
+ /* Saves the notification ID for future use */
+ var myId = notification.id;
+
+ var myNotification = tizen.notification.get(myId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::getAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var notifications = tizen.notification.getAll();
- var index = 0;
-
- for ( index = 0; index < notifications.length; index++ )
- {
- console.log(notifications[index].id);
- console.log(notifications[index].title);
- console.log(notifications[index].statusType);
- console.log(notifications[index].type);
- console.log(notifications[index].content);
- console.log(notifications[index].postedTime);
- console.log(notifications[index].iconPath);
- console.log(notifications[index].soundPath);
- console.log(notifications[index].vibration);
- console.log(notifications[index].appControl);
- }
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var notifications = tizen.notification.getAll();
+ var index = 0;
+
+ for (index = 0; index < notifications.length; index++)
+ {
+ console.log(notifications[index].id);
+ console.log(notifications[index].title);
+ console.log(notifications[index].statusType);
+ console.log(notifications[index].type);
+ console.log(notifications[index].content);
+ console.log(notifications[index].postedTime);
+ console.log(notifications[index].iconPath);
+ console.log(notifications[index].soundPath);
+ console.log(notifications[index].vibration);
+ console.log(notifications[index].appControl);
+ }
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::playLEDCustomEffect">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.notification.playLEDCustomEffect(1000, 1000, "#FFFF0080", ["LED_CUSTOM_DUTY_ON", "LED_CUSTOM_DEFAULT"]);
- } catch(e) {
- console.log("Error Exception, error name : " + e.name + ", error message : " + e.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.notification.playLEDCustomEffect(1000, 1000, "#FFFF0080", ["LED_CUSTOM_DUTY_ON", "LED_CUSTOM_DEFAULT"]);
+}
+catch (e)
+{
+ console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::stopLEDCustomEffect">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.notification.playLEDCustomEffect(1000, 1000, "#FFFF0080", ["LED_CUSTOM_DUTY_ON", "LED_CUSTOM_DEFAULT"]);
- setTimeout(function () {
- tizen.notification.stopLEDCustomEffect();
- }, 5000);
- } catch(e) {
- console.log("Error Exception, error name : " + e.name + ", error message : " + e.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.notification.playLEDCustomEffect(1000, 1000, "#FFFF0080", ["LED_CUSTOM_DUTY_ON", "LED_CUSTOM_DEFAULT"]);
+ setTimeout(function()
+ {
+ tizen.notification.stopLEDCustomEffect();
+ }, 5000);
+}
+catch (e)
+{
+ console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
+}
+</pre>
</div>
</dd>
</dl>
2.2
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var notificationDict = {
- content : "This is a simple notification.",
- iconPath : "images/image1.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true,
- ledColor : "#FFFF00",
- ledOnPeriod: 1000,
- ledOffPeriod : 500 };
-
- var notification = new tizen.StatusNotification("SIMPLE",
- "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ ledColor: "#FFFF00",
+ ledOnPeriod: 1000,
+ ledOffPeriod: 500
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</li>
<li class="attribute" id="StatusNotification::ledOnPeriod">
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- // Gets the current application information with tizen.application.getAppInfo
- var myappInfo = tizen.application.getAppInfo();
-
- var notificationDict = {
- content : "This is a simple notification.",
- iconPath : "images/image1.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true,
- appId : myappInfo.id };
-
- var notification = new tizen.StatusNotification("SIMPLE",
- "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Gets the current application information with tizen.application.getAppInfo */
+ var myappInfo = tizen.application.getAppInfo();
+
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appId: myappInfo.id
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</li>
<li class="attribute" id="StatusNotification::progressType">
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/create_content",
- null,
- "image/jpg",
- null);
-
- var notificationDict = {
- content : "This is a progress notification.",
- iconPath : "images/image2.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true,
- appControl : appControl,
- progressValue : 20};
- // Constructs the progress notification
- var notification = new tizen.StatusNotification("PROGRESS",
- "Progress notification", notificationDict);
- // Posts the notification
- tizen.notification.post(notification);
-
- // Updates the progress value of the notification
- notification.progressValue = 59;
- tizen.notification.update(notification);
-
-
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
+ null, "image/jpg", null);
+
+ var notificationDict =
+ {
+ content: "This is a progress notification.",
+ iconPath: "images/image2.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appControl: appControl,
+ progressValue: 20
+ };
+ /* Constructs the progress notification */
+ var notification = new tizen.StatusNotification("PROGRESS", "Progress notification", notificationDict);
+ /* Posts the notification */
+ tizen.notification.post(notification);
+
+ /* Updates the progress value of the notification */
+ notification.progressValue = 59;
+ tizen.notification.update(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</li>
</ul>
2.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013');
- notification.detailInfo = [detailInfo1];
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013');
+notification.detailInfo = [detailInfo1];
</pre>
</div>
<div class="constructors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var onInstallation = {
- onprogress: function(packageId, percentage) {
- console.log("On installation(" + packageId + ") : progress(" + percentage + ")");
- },
- oncomplete: function(packageId) {
- console.log("Installation(" + packageId + ") Complete");
- }
- }
-
- var onError = function (err) {
- console.log("Error occurred on installation : " + err.name);
- }
-
- // Let's assume that the "test.wgt" file exists in the downloads directory
- tizen.filesystem.resolve("downloads/test.wgt",
- function (file) {
- console.log("file URI : " + file.toURI());
- tizen.package.install(file.toURI(), onInstallation, onError);
- },
- function (err) {
- console.log("Error occurred on resolve : " + err.name);
- },
- "r");
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var onInstallation =
+{
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On installation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Installation(" + packageId + ") Complete");
+ }
+}
+
+var onError = function(err)
+{
+ console.log("Error occurred on installation: " + err.name);
+}
+
+/* Let's assume that the "test.wgt" file exists in the downloads directory */
+tizen.filesystem.resolve("downloads/test.wgt", function(file)
+{
+ console.log("file URI: " + file.toURI());
+ tizen.package.install(file.toURI(), onInstallation, onError);
+}, function(err)
+{
+ console.log("Error occurred on resolve: " + err.name);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::uninstall">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var onUninstallation = {
- onprogress: function(packageId, percentage) {
- console.log("On Uninstallation(" + packageId + ") : progress(" + percentage + ")");
- },
- oncomplete: function(packageId) {
- console.log("Uninstallation(" + packageId + ") Complete");
- }
- };
-
- var onError = function (err) {
- console.log("Error occurred on installation : " + err.name);
- };
-
- // Let's assume that the package ID to uninstall is "testapp001"
- tizen.package.uninstall("testapp001", onUninstallation, onError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var onUninstallation =
+{
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Uninstallation(" + packageId + ") Complete");
+ }
+};
+
+var onError = function(err)
+{
+ console.log("Error occurred on installation: " + err.name);
+};
+
+/* Let's assume that the package ID to uninstall is "testapp001" */
+tizen.package.uninstall("testapp001", onUninstallation, onError);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::getPackagesInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledPackages(packages) {
- for (var i = 0; i < packages.length; i++) {
- console.log("Package id["+i+"] : " +packages[i].id);
- }
- }
-
- tizen.package.getPackagesInfo(
- onListInstalledPackages,
- function (err) {console.log("Can't obtain packages list" + err.name);});
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledPackages(packages)
+{
+ for (var i = 0; i < packages.length; i++)
+ {
+ console.log("Package id[" + i + "]: " + packages[i].id);
+ }
+}
+
+tizen.package.getPackagesInfo(onListInstalledPackages, function(err)
+{
+ console.log("Can't obtain packages list" + err.name);
+});
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::getPackageInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var packageInfo = tizen.package.getPackageInfo(null);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var packageInfo = tizen.package.getPackageInfo(null);
- console.log("Current Package ID : " + packageInfo.id);
- </pre>
+console.log("Current Package ID: " + packageInfo.id);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::setPackageInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var packageEventCallback = {
- oninstalled: function(packageInfo) {
- console.log('The package ' + packageInfo.name + ' is installed');
- },
- onupdated: function(packageInfo) {
- console.log('The package ' + packageInfo.name + ' is updated');
- },
- onuninstalled: function(packageId) {
- console.log('The package ' + packageId + ' is uninstalled');
- }
- };
-
- tizen.package.setPackageInfoEventListener(packageEventCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var packageEventCallback =
+{
+ oninstalled: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is installed');
+ },
+ onupdated: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is updated');
+ },
+ onuninstalled: function(packageId)
+ {
+ console.log('The package ' + packageId + ' is uninstalled');
+ }
+};
+
+tizen.package.setPackageInfoEventListener(packageEventCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::unsetPackageInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.package.unsetPackageInfoEventListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.package.unsetPackageInfoEventListener();
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.power.request("SCREEN", "SCREEN_NORMAL");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.power.request("SCREEN", "SCREEN_NORMAL");
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::release">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Release SCREEN resource.
- tizen.power.release("SCREEN");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Release SCREEN resource */
+tizen.power.release("SCREEN");
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::setScreenStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onScreenStateChanged(previousState, changedState) {
- console.log("Screen state changed from " + previousState + " to " + changedState);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onScreenStateChanged(previousState, changedState)
+{
+ console.log("Screen state changed from " + previousState + " to " + changedState);
+}
- // Sets the screen state change listener.
- tizen.power.setScreenStateChangeListener(onScreenStateChanged);
- </pre>
+/* Sets the screen state change listener */
+tizen.power.setScreenStateChangeListener(onScreenStateChanged);
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::unsetScreenStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Unsets the screen state change listener.
- tizen.power.unsetScreenStateChangeListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Unsets the screen state change listener */
+tizen.power.unsetScreenStateChangeListener();
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::getScreenBrightness">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current screen brightness value.
- var screenBrightness = tizen.power.getScreenBrightness();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current screen brightness value */
+var screenBrightness = tizen.power.getScreenBrightness();
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::setScreenBrightness">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sets the screen brightness value for the application.
- tizen.power.setScreenBrightness(1);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sets the screen brightness value for the application */
+tizen.power.setScreenBrightness(1);
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::isScreenOn">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Checks whether the screen is on or off.
- var isScreenOn = tizen.power.isScreenOn();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Checks whether the screen is on or off */
+var isScreenOn = tizen.power.isScreenOn();
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::restoreScreenBrightness">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Restores the screen brightness value to the system default setting value.
- tizen.power.restoreScreenBrightness();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Restores the screen brightness value to the system default setting value */
+tizen.power.restoreScreenBrightness();
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::turnScreenOn">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Turns the screen on.
- tizen.power.turnScreenOn();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Turns the screen on */
+tizen.power.turnScreenOn();
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::turnScreenOff">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Turns the screen off.
- tizen.power.turnScreenOff();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Turns the screen off */
+tizen.power.turnScreenOff();
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var successCB = function(preferences) {
- if (preferences.length) {
- console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var successCB = function(preferences)
+{
+ if (preferences.length)
+ {
+ console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
+ }
+};
- tizen.preference.getAll(successCB);
- </pre>
+tizen.preference.getAll(successCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> The first preference - key: key1 value: Sample value
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.preference.setValue('key1', 'New value');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.preference.setValue('key1', 'New value');
+</pre>
</div>
</dd>
<dt class="method" id="PreferenceManager::getValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var currentValue = tizen.preference.getValue('key1');
- console.log('The current value of the preference key1 is: ' + currentValue);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var currentValue = tizen.preference.getValue('key1');
+console.log('The current value of the preference key1 is: ' + currentValue);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> The current value of the preference key1 is: New value
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.preference.remove('key1');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.preference.remove('key1');
+</pre>
</div>
</dd>
<dt class="method" id="PreferenceManager::removeAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.preference.removeAll();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.preference.removeAll();
+</pre>
</div>
</dd>
<dt class="method" id="PreferenceManager::exists">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> if (tizen.preference.exists('key1')) {
- console.log('Preference with the key key1 exists');
- } else {
- console.log('Preference with the key key1 doesn't exist');
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+if (tizen.preference.exists('key1'))
+{
+ console.log('Preference with the key key1 exists');
+}
+else
+{
+ console.log('Preference with the key key1 doesn't exist');
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Preference with the key key1 exists
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = function(data) {
- console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener = function(data)
+{
+ console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
+};
- tizen.preference.setChangeListener('key1', listener);
- </pre>
+tizen.preference.setChangeListener('key1', listener);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Preference with the key: key1 has a new value: Sample value
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = function(data) {
- tizen.preference.unsetChangeListener(data.key);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener = function(data)
+{
+ tizen.preference.unsetChangeListener(data.key);
+};
- tizen.preference.setChangeListener('key1', listener);
- </pre>
+tizen.preference.setChangeListener('key1', listener);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = function(data) {
- tizen.preference.unsetChangeListener(data.key);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener = function(data)
+{
+ tizen.preference.unsetChangeListener(data.key);
+};
- tizen.preference.setChangeListener('key1', listener);
- </pre>
+tizen.preference.setChangeListener('key1', listener);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var successCB = function(preferences) {
- if (preferences.length) {
- console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var successCB = function(preferences)
+{
+ if (preferences.length)
+ {
+ console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
+ }
+};
- tizen.preference.getAll(successCB);
- </pre>
+tizen.preference.getAll(successCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> First preference - key: key1 value: Sample value
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the data to be used when this process is launched by notification service.
- var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the data to be used when this process is launched by notification service */
+var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");
- // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
- // Defines the registration success callback
- function registerSuccessCallback(id) {
- console.log("Registration succeeded with id: " + id);
- }
+/* Defines the registration success callback */
+function registerSuccessCallback(id)
+{
+ console.log("Registration succeeded with id: " + id);
+}
- // Requests registration.
- tizen.push.registerService(service, registerSuccessCallback, errorCallback);
- </pre>
+/* Requests registration */
+tizen.push.registerService(service, registerSuccessCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::register">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCallback(response) {
- console.log("The following error occurred: " + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log("The following error occurred: " + response.name);
+}
- // Defines the registration success callback
- function registerSuccessCallback(id) {
- console.log("Registration succeeded with id: " + id);
- }
+/* Defines the registration success callback */
+function registerSuccessCallback(id)
+{
+ console.log("Registration succeeded with id: " + id);
+}
- // Requests application registration.
- tizen.push.register(registerSuccessCallback, errorCallback);
- </pre>
+/* Requests application registration */
+tizen.push.register(registerSuccessCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
- // Defines the unregistration success callback
- function unregisterSuccessCallback() {
- console.log("Unregistration succeeded.");
- }
+/* Defines the unregistration success callback */
+function unregisterSuccessCallback()
+{
+ console.log("Unregistration succeeded.");
+}
- // Requests unregistration
- tizen.push.unregisterService(unregisterSuccessCallback, errorCallback);
- </pre>
+/* Requests unregistration */
+tizen.push.unregisterService(unregisterSuccessCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::unregister">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback
- function errorCallback(response) {
- console.log("The following error occurred: " + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log("The following error occurred: " + response.name);
+}
- // Defines the unregistration success callback
- function unregisterSuccessCallback() {
- console.log("Unregistration succeeded.");
- }
+/* Defines the unregistration success callback */
+function unregisterSuccessCallback()
+{
+ console.log("Unregistration succeeded.");
+}
- // Requests unregistration
- tizen.push.unregister(unregisterSuccessCallback, errorCallback);
- </pre>
+/* Requests unregistration */
+tizen.push.unregister(unregisterSuccessCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Unregistration succeeded.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the registration error callback.
- function errorCallback(response) {
- console.log("The following error occurred: " + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the registration error callback */
+function errorCallback(response)
+{
+ console.log("The following error occurred: " + response.name);
+}
- // Defines the registration success callback
- function registerSuccessCallback(id) {
- console.log("Registration succeeded with id: " + id);
- }
+/* Defines the registration success callback */
+function registerSuccessCallback(id)
+{
+ console.log("Registration succeeded with id: " + id);
+}
- // Requests application registration.
- tizen.push.register(registerSuccessCallback, errorCallback);
+/* Requests application registration */
+tizen.push.register(registerSuccessCallback, errorCallback);
- // Defines the connect success callback
- function notificationCallback(noti) {
- console.log("Notification received with alert message: " + noti.alertMessage);
- }
+/* Defines the connect success callback */
+function notificationCallback(noti)
+{
+ console.log("Notification received with alert message: " + noti.alertMessage);
+}
- // Requests for push service connection
- tizen.push.connectService(notificationCallback);
- </pre>
+/* Requests for push service connection */
+tizen.push.connectService(notificationCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::disconnectService">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests disconnection
- tizen.push.disconnectService();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests disconnection */
+tizen.push.disconnectService();
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::getRegistrationId">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var registrationId = tizen.push.getRegistrationId();
- if ( registrationId != null ) {
- console.log("The registration id: " + registrationId);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var registrationId = tizen.push.getRegistrationId();
+if (registrationId != null)
+{
+ console.log("The registration id: " + registrationId);
+}
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::getUnreadNotifications">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the connect success callback
- function notificationCallback(message) {
- console.log("New push message : " + message.alertMessage + ", date : " + message.date + ", data : " + message.appData);
- }
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the connect success callback */
+function notificationCallback(message)
+{
+ console.log("New push message: " + message.alertMessage + ", date: " + message.date + ", data: " + message.appData);
+}
- // Requests for push service connection
- tizen.push.connectService(notificationCallback);
- tizen.push.getUnreadNotifications();
- </pre>
+/* Requests for push service connection */
+tizen.push.connectService(notificationCallback);
+tizen.push.getUnreadNotifications();
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::getPushMessage">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var message = tizen.push.getPushMessage();
- console.log('Message received from: ' + message.sender);
- } catch (err) {
- console.log('Exception - code: ' + err.name + ' message: ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var message = tizen.push.getPushMessage();
+ console.log('Message received from: ' + message.sender);
+}
+catch (err)
+{
+ console.log('Exception - code: ' + err.name + ' message: ' + err.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Message received from: xyz.AnotherApp
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the connect success callback
- function notificationCallback(noti) {
- console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
- console.log('Details:');
- console.log(' - data: ' + noti.appData);
- console.log(' - alert message: ' + noti.alertMessage);
- console.log(' - message: ' + noti.message);
- console.log(' - session: ' + noti.sessionInfo);
- console.log(' - request ID: ' + noti.requestId);
- console.log(' - type: ' + noti.type);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the connect success callback */
+function notificationCallback(noti)
+{
+ console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
+ console.log('Details:');
+ console.log(' - data: ' + noti.appData);
+ console.log(' - alert message: ' + noti.alertMessage);
+ console.log(' - message: ' + noti.message);
+ console.log(' - session: ' + noti.sessionInfo);
+ console.log(' - request ID: ' + noti.requestId);
+ console.log(' - type: ' + noti.type);
+}
- // Requests for push service connection
- tizen.push.connectService(notificationCallback);
- </pre>
+/* Requests for push service connection */
+tizen.push.connectService(notificationCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Notification received on Thu Jan 01 2015 from: xyz.AnotherApp
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- function success(readers) {
- for (var i = 0; i < readers.length; i++) {
- if (readers[i].isPresent) {
- console.log ("Reader Name : " + readers[i].getName());
- }
- }
- }
- function error(err) {
- console.log (err.name + ": " + err.message);
- }
- tizen.seService.getReaders(success, error);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ function success(readers)
+ {
+ for (var i = 0; i < readers.length; i++)
+ {
+ if (readers[i].isPresent)
+ {
+ console.log("Reader Name: " + readers[i].getName());
+ }
+ }
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ tizen.seService.getReaders(success, error);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SEService::registerSEListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- onSEReady: function(reader) {
- console.log(reader.getName() + " is ready.");
- },
- onSENotReady: function(reader) {
- console.log(reader.getName() + " is not ready.");
- },
- onSEError: function(reader, error) {
- console.log(reader.getName() + ": error occurred: " + error.message);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ onSEReady: function(reader)
+ {
+ console.log(reader.getName() + " is ready.");
+ },
+ onSENotReady: function(reader)
+ {
+ console.log(reader.getName() + " is not ready.");
+ },
+ onSEError: function(reader, error)
+ {
+ console.log(reader.getName() + ": error occurred: " + error.message);
+ }
+};
- try {
- var seListener = tizen.seService.registerSEListener(listener);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+try
+{
+ var seListener = tizen.seService.registerSEListener(listener);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SEService::unregisterSEListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var seListener; //seListener obtained from registerSEListener
- try {
- tizen.seService.unregisterSEListener(seListener);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var seListener; /* seListener obtained from registerSEListener */
+try
+{
+ tizen.seService.unregisterSEListener(seListener);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SEService::shutdown">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.seService.shutdown();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.seService.shutdown();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- function success(readers) {
- for (var i = 0; i < readers.length; i++) {
- if (readers[i].isPresent) {
- console.log ("Reader Name : " + readers[i].getName());
- }
- }
- }
- function error(err) {
- console.log (err.name + ": " + err.message);
- }
- tizen.seService.getReaders(success, error);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ function success(readers)
+ {
+ for (var i = 0; i < readers.length; i++)
+ {
+ if (readers[i].isPresent)
+ {
+ console.log("Reader Name: " + readers[i].getName());
+ }
+ }
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ tizen.seService.getReaders(success, error);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Reader::openSession">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- function success(session) {
- console.log ("Open Session Success : " + !session.isClosed);
- }
- function error(err) {
- console.log (err.name + ": " + err.message);
- }
- reader.openSession(success, error);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ function success(session)
+ {
+ console.log("Open Session Success: " + !session.isClosed);
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ reader.openSession(success, error);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Reader::closeSessions">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- reader.closeSessions();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ reader.closeSessions();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- function successChannel(channel) {
- if (channel.isBasicChannel) {
- console.log ("Basic channel is opened.");
- } else {
- console.log ("Logical channel is opened.");
- }
- }
- function errorChannel(err) {
- console.log ("openBasicChannel Error :" + err.name +": " + err.message);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ function successChannel(channel)
+ {
+ if (channel.isBasicChannel)
+ {
+ console.log("Basic channel is opened.");
+ }
+ else
+ {
+ console.log("Logical channel is opened.");
+ }
+ }
+ function errorChannel(err)
+ {
+ console.log("openBasicChannel Error:" + err.name +": " + err.message);
+ }
- function successSession(session) {
- console.log ("Open Session Success : " + !session.isClosed);
- // This aid is for test. Use aid for your applet in secure element.
- session.openBasicChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
- }
- function errorSession(err) {
- console.log ("openSession Error : " + err.name + ": " + err.message);
- }
- reader.openSession(successSession, errorSession);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+ function successSession(session)
+ {
+ console.log("Open Session Success: " + !session.isClosed);
+ /* This aid is for test. Use aid for your applet in secure element */
+ session.openBasicChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
+ }
+ function errorSession(err)
+ {
+ console.log("openSession Error: " + err.name + ": " + err.message);
+ }
+ reader.openSession(successSession, errorSession);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Session::openLogicalChannel">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var session; //Session obtained from openSession callback
- try {
- function successChannel(channel) {
- if (channel.isBasicChannel) {
- console.log ("Basic channel is opened.");
- } else {
- console.log ("Logical channel is opened.");
- }
- }
- function errorChannel(err) {
- console.log ("openLogicalChannel Error :" + err.name + ": " + err.message);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var session; /* Session obtained from openSession callback */
+try
+{
+ function successChannel(channel)
+ {
+ if (channel.isBasicChannel)
+ {
+ console.log("Basic channel is opened.");
+ }
+ else
+ {
+ console.log("Logical channel is opened.");
+ }
+ }
+ function errorChannel(err)
+ {
+ console.log("openLogicalChannel Error:" + err.name + ": " + err.message);
+ }
- // This aid is for test. Use aid for your applet in secure element.
- session.openLogicalChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+ /* This aid is for test. Use aid for your applet in secure element */
+ session.openLogicalChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Session::getATR">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var session; //Session obtained from openSession callback
- try {
- var atr = session.getATR();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var session; /* Session obtained from openSession callback */
+try
+{
+ var atr = session.getATR();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Session::close">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var session; //Session obtained from openSession callback
- try {
- session.close();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var session; /* Session obtained from openSession callback */
+try
+{
+ session.close();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Session::closeChannels">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var session; //Session obtained from openSession callback
- try {
- session.closeChannels();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var session; /* Session obtained from openSession callback */
+try
+{
+ session.closeChannels();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var channel; //Obtained from openLogicalChannel or openBasicChannel
- try {
- channel.close();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var channel; /* Obtained from openLogicalChannel or openBasicChannel */
+try
+{
+ channel.close();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Channel::transmit">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximityCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.proximity");
-
- if (proximityCapability === true) {
- // the device supports proximity sensor and you can get proximity sensor's data
- var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- } else {
- // If tizen.sensorservice.getDefaultSensor("PROXIMITY") is used, NotSupportedError would be thrown.
- console.log("Proximity sensor is not supported on this device.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximityCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.proximity");
+
+if (proximityCapability === true)
+{
+ /* Device supports proximity sensor and you can get proximity sensor's data */
+ var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+}
+else
+{
+ /* If tizen.sensorservice.getDefaultSensor("PROXIMITY") is used, NotSupportedError is thrown */
+ console.log("Proximity sensor is not supported on this device.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SensorService::getAvailableSensors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var sensorCapabilities = tizen.sensorservice.getAvailableSensors();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var sensorCapabilities = tizen.sensorservice.getAvailableSensors();
- console.log("capable sensor : " + sensorCapabilities[0]);
- </pre>
+console.log("capable sensor: " + sensorCapabilities[0]);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- function onsuccessCB() {
- console.log("The proximity sensor started successfully.");
- }
+function onsuccessCB()
+{
+ console.log("The proximity sensor started successfully.");
+}
- proximitySensor.start(onsuccessCB);
- </pre>
+proximitySensor.start(onsuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="Sensor::stop">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- function onsuccessCB() {
- console.log("proximity sensor start");
- proximitySensor.stop();
- }
+function onsuccessCB()
+{
+ console.log("proximity sensor start");
+ proximitySensor.stop();
+}
- proximitySensor.start(onsuccessCB);
- </pre>
+proximitySensor.start(onsuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="Sensor::setChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
- function onsuccessCB() {
+function onsuccessCB()
+{
console.log("light sensor start");
- }
+}
- function onchangedCB(sensorData) {
+function onchangedCB(sensorData)
+{
console.log("light level: " + sensorData.lightLevel);
- }
+}
- // interval and batchLatency can be ommitted.
- lightSensor.setChangeListener(onchangedCB, 200, 2000);
+/* interval and batchLatency can be omitted */
+lightSensor.setChangeListener(onchangedCB, 200, 2000);
- lightSensor.start(onsuccessCB);
- </pre>
+lightSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="Sensor::unsetChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- function onchangedCB(sensorData) {
- console.log("proximity distance : " + sensorData.proximityState);
- }
+function onchangedCB(sensorData)
+{
+ console.log("proximity distance: " + sensorData.proximityState);
+}
- proximitySensor.setChangeListener(onchangedCB);
+proximitySensor.setChangeListener(onchangedCB);
- proximitySensor.unsetChangeListener();
- </pre>
+proximitySensor.unsetChangeListener();
+</pre>
</div>
</dd>
<dt class="method" id="Sensor::getSensorHardwareInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gravitySensor = tizen.sensorservice.getDefaultSensor("GRAVITY");
- gravitySensor.getSensorHardwareInfo(onsuccessCB);
-
- function onsuccessCB(hardwareInfo){
- console.log("name: " + hardwareInfo.name);
- console.log("type: " + hardwareInfo.type);
- console.log("vendor: " + hardwareInfo.vendor);
- console.log("minValue: " + hardwareInfo.minValue);
- console.log("maxValue: " + hardwareInfo.maxValue);
- console.log("resolution: " + hardwareInfo.resolution);
- console.log("minInterval: " + hardwareInfo.minInterval);
- console.log("maxBatchCount: " + hardwareInfo.maxBatchCount);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gravitySensor = tizen.sensorservice.getDefaultSensor("GRAVITY");
+gravitySensor.getSensorHardwareInfo(onsuccessCB);
+
+function onsuccessCB(hardwareInfo)
+{
+ console.log("name: " + hardwareInfo.name);
+ console.log("type: " + hardwareInfo.type);
+ console.log("vendor: " + hardwareInfo.vendor);
+ console.log("minValue: " + hardwareInfo.minValue);
+ console.log("maxValue: " + hardwareInfo.maxValue);
+ console.log("resolution: " + hardwareInfo.resolution);
+ console.log("minInterval: " + hardwareInfo.minInterval);
+ console.log("maxBatchCount: " + hardwareInfo.maxBatchCount);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> name: Gravity Sensor
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
-
- function onGetSuccessCB(sensorData) {
- console.log("light level : " + sensorData.lightLevel);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
- function onerrorCB(error) {
- console.log("error occurs");
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("light level: " + sensorData.lightLevel);
+}
- function onsuccessCB() {
- console.log("sensor start");
- lightSensor.getLightSensorData(onGetSuccessCB, onerrorCB);
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- lightSensor.start(onsuccessCB);
+function onsuccessCB()
+{
+ console.log("sensor start");
+ lightSensor.getLightSensorData(onGetSuccessCB, onerrorCB);
+}
- </pre>
+lightSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var magneticSensor = tizen.sensorservice.getDefaultSensor("MAGNETIC");
-
- function onGetSuccessCB(sensorData) {
- console.log("magnetic field of the X axis : " + sensorData.x);
- console.log("magnetic field of the Y axis : " + sensorData.y);
- console.log("magnetic field of the Z axis : " + sensorData.z);
- }
-
- function onerrorCB(error) {
- console.log("error occurs");
- }
-
- function onsuccessCB() {
- console.log("sensor start");
- magneticSensor.getMagneticSensorData(onGetSuccessCB, onerrorCB);
- }
-
- magneticSensor.start(onsuccessCB);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var magneticSensor = tizen.sensorservice.getDefaultSensor("MAGNETIC");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("magnetic field of the X axis: " + sensorData.x);
+ console.log("magnetic field of the Y axis: " + sensorData.y);
+ console.log("magnetic field of the Z axis: " + sensorData.z);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("sensor start");
+ magneticSensor.getMagneticSensorData(onGetSuccessCB, onerrorCB);
+}
+
+magneticSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var pressureSensor = tizen.sensorservice.getDefaultSensor("PRESSURE");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var pressureSensor = tizen.sensorservice.getDefaultSensor("PRESSURE");
- function onGetSuccessCB(sensorData) {
- console.log("pressure : " + sensorData.pressure);
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("pressure: " + sensorData.pressure);
+}
- function onerrorCB(error) {
- console.log("error occurs");
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- function onsuccessCB() {
- console.log("sensor start");
- pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
- }
+function onsuccessCB()
+{
+ console.log("sensor start");
+ pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
+}
- pressureSensor.start(onsuccessCB);
-
- </pre>
+pressureSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
-
- function onGetSuccessCB(sensorData) {
- console.log("proximity state : " + sensorData.proximityState);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- function onerrorCB(error) {
- console.log("error occurs");
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("proximity state: " + sensorData.proximityState);
+}
- function onsuccessCB() {
- console.log("proximity sensor start");
- proximitySensor.getProximitySensorData(onGetSuccessCB, onerrorCB);
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- proximitySensor.start(onsuccessCB);
+function onsuccessCB()
+{
+ console.log("proximity sensor start");
+ proximitySensor.getProximitySensorData(onGetSuccessCB, onerrorCB);
+}
- </pre>
+proximitySensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var ultravioletSensor = tizen.sensorservice.getDefaultSensor("ULTRAVIOLET");
-
- function onGetSuccessCB(sensorData) {
- console.log("ultraviolet level : " + sensorData.ultravioletLevel);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var ultravioletSensor = tizen.sensorservice.getDefaultSensor("ULTRAVIOLET");
- function onerrorCB(error) {
- console.log("error occurs");
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("ultraviolet level: " + sensorData.ultravioletLevel);
+}
- function onsuccessCB() {
- console.log("ultraviolet sensor start");
- ultravioletSensor.getUltravioletSensorData(onGetSuccessCB, onerrorCB);
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- ultravioletSensor.start(onsuccessCB);
+function onsuccessCB()
+{
+ console.log("ultraviolet sensor start");
+ ultravioletSensor.getUltravioletSensorData(onGetSuccessCB, onerrorCB);
+}
- </pre>
+ultravioletSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var HRMrawsensor = tizen.sensorservice.getDefaultSensor("HRM_RAW");
-
- function onGetSuccessCB(sensorData) {
- console.log("HRMRaw light intensity : " + sensorData.lightIntensity);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var HRMrawsensor = tizen.sensorservice.getDefaultSensor("HRM_RAW");
- function onerrorCB(error) {
- console.log("error occurs");
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("HRMRaw light intensity: " + sensorData.lightIntensity);
+}
- function onsuccessCB() {
- console.log("HRMRaw sensor start");
- HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- HRMrawsensor.start(onsuccessCB);
+function onsuccessCB()
+{
+ console.log("HRMRaw sensor start");
+ HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
+}
- </pre>
+HRMrawsensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gravitySensor = tizen.sensorservice.getDefaultSensor("GRAVITY");
-
- function onGetSuccessCB(sensorData) {
- console.log("######## Get the gravity sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- }
-
- function onerrorCB(error) {
- console.log("error occurs");
- }
-
- function onsuccessCB() {
- console.log("sensor start");
- gravitySensor.getGravitySensorData(onGetSuccessCB, onerrorCB);
- }
-
- gravitySensor.start(onsuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gravitySensor = tizen.sensorservice.getDefaultSensor("GRAVITY");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("######## Get the gravity sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("sensor start");
+ gravitySensor.getGravitySensorData(onGetSuccessCB, onerrorCB);
+}
+
+gravitySensor.start(onsuccessCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> sensor start
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gyroscopeSensor = tizen.sensorservice.getDefaultSensor("GYROSCOPE");
-
- function onGetSuccessCB(sensorData) {
- console.log("######## Get the gyroscope sensor date ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- }
-
- function onerrorCB(error) {
- console.log("error occurs");
- }
-
- function onsuccessCB() {
- console.log("sensor start");
- gyroscopeSensor.getGyroscopeSensorData(onGetSuccessCB, onerrorCB);
- }
-
- gyroscopeSensor.start(onsuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gyroscopeSensor = tizen.sensorservice.getDefaultSensor("GYROSCOPE");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("######## Get the gyroscope sensor date ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("sensor start");
+ gyroscopeSensor.getGyroscopeSensorData(onGetSuccessCB, onerrorCB);
+}
+
+gyroscopeSensor.start(onsuccessCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> sensor start
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gyroscopeRotationVectorSensor = tizen.sensorservice.getDefaultSensor("GYROSCOPE_ROTATION_VECTOR");
-
- function onGetSuccessCB(sensorData) {
- console.log("######## Get the gyroscope rotation vector sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- console.log("w: " + sensorData.w);
- }
-
- function onerrorCB(error) {
- console.log("error occurs");
- }
-
- function onsuccessCB() {
- console.log("sensor start");
- gyroscopeRotationVectorSensor.getGyroscopeRotationVectorSensorData(onGetSuccessCB, onerrorCB);
- }
-
- gyroscopeRotationVectorSensor.start(onsuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gyroscopeRotationVectorSensor = tizen.sensorservice.getDefaultSensor("GYROSCOPE_ROTATION_VECTOR");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("######## Get the gyroscope rotation vector sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+ console.log("w: " + sensorData.w);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("sensor start");
+ gyroscopeRotationVectorSensor.getGyroscopeRotationVectorSensorData(onGetSuccessCB, onerrorCB);
+}
+
+gyroscopeRotationVectorSensor.start(onsuccessCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> sensor start
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var linearAccelerationSensor = tizen.sensorservice.getDefaultSensor("LINEAR_ACCELERATION");
-
- function onGetSuccessCB(sensorData) {
- console.log("######## Get the linear acceleration sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- }
-
- function onerrorCB(error) {
- console.log("error occured");
- }
-
- function onsuccessCB() {
- console.log("linear acceleration sensor start");
- linearAccelerationSensor.getLinearAccelerationSensorData(onGetSuccessCB, onerrorCB);
- }
-
- linearAccelerationSensor.start(onsuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var linearAccelerationSensor = tizen.sensorservice.getDefaultSensor("LINEAR_ACCELERATION");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("######## Get the linear acceleration sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("linear acceleration sensor start");
+ linearAccelerationSensor.getLinearAccelerationSensorData(onGetSuccessCB, onerrorCB);
+}
+
+linearAccelerationSensor.start(onsuccessCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> linear acceleration sensor start
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var infoArr = tizen.sound.getConnectedDeviceList();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var infoArr = tizen.sound.getConnectedDeviceList();
- for (var i = 0; i < infoArr.length; i++) {
- console.log( infoArr[i].device );
- }
- </pre>
+for (var i = 0; i < infoArr.length; i++)
+{
+ console.log(infoArr[i].device);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SoundManager::getActivatedDeviceList">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var infoArr = tizen.sound.getActivatedDeviceList();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var infoArr = tizen.sound.getActivatedDeviceList();
- for (var i = 0; i < infoArr.length; i++) {
- console.log( infoArr[i].device );
- }
- </pre>
+for (var i = 0; i < infoArr.length; i++)
+{
+ console.log(infoArr[i].device);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SoundManager::addDeviceStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // A callback
- var onChanged = function(info) {
- // Some code to execute when a sound device state is changed
- if (info.isConnected) {
- // Some code to execute if the device is connected.
- console.log( info.device + " is connected" );
- } else {
- // Some code to execute if the device is not connected.
- console.log( info.device + " is not connected" );
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Callback */
+var onChanged = function(info)
+{
+ /* Some code to execute when a sound device state is changed */
+ if (info.isConnected)
+ {
+ /* Some code to execute if the device is connected */
+ console.log(info.device + " is connected");
+ }
+ else
+ {
+ /* Some code to execute if the device is not connected */
+ console.log(info.device + " is not connected");
+ }
- if (info.isActivated) {
- // Some code to execute if the device is activated.
- console.log( info.device + " is activated" );
- } else {
- // Some code to execute if the device is not activated.
- console.log( info.device + " is not activated" );
- }
- }
+ if (info.isActivated)
+ {
+ /* Some code to execute if the device is activated */
+ console.log(info.device + " is activated");
+ }
+ else
+ {
+ /* Some code to execute if the device is not activated */
+ console.log(info.device + " is not activated");
+ }
+}
- var id = tizen.sound.addDeviceStateChangeListener(onChanged);
- </pre>
+var id = tizen.sound.addDeviceStateChangeListener(onChanged);
+</pre>
</div>
</dd>
<dt class="method" id="SoundManager::removeDeviceStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // If a listener to be called was registered previously.
- tizen.sound.removeDeviceStateChangeListener(id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* If a listener to be called was registered previously */
+tizen.sound.removeDeviceStateChangeListener(id);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // To get total amount of system memory
- console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* To get total amount of system memory */
+console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getAvailableMemory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // To get total amount of system memory
- console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* To get total amount of system memory */
+console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getCapabilities">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var deviceCapabilities;
- deviceCapabilities = tizen.systeminfo.getCapabilities();
- if (deviceCapabilities.bluetooth) {
- console.log("Bluetooth is supported");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var deviceCapabilities;
+deviceCapabilities = tizen.systeminfo.getCapabilities();
+if (deviceCapabilities.bluetooth)
+{
+ console.log("Bluetooth is supported");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getCapability">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Checks if a device supports bluetooth API or not
- var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
- console.log(" Bluetooth = " + bluetooth);
- } catch (error) {
- console.log("Error name: " + error.name + ", message: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Checks if a device supports bluetooth API */
+ var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
+ console.log(" Bluetooth = " + bluetooth);
+}
+catch (error)
+{
+ console.log("Error name: " + error.name + ", message: " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getCount">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var count = tizen.systeminfo.getCount("SIM");
- if (count === 0) {
- console.log("There is no available SIM card.");
- } else {
- console.log("There is(are) " + count + " SIM card(s) available.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var count = tizen.systeminfo.getCount("SIM");
+if (count === 0)
+{
+ console.log("There is no available SIM card.");
+}
+else
+{
+ console.log("There is(are) " + count + " SIM card(s) available.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getPropertyValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cpu) {
- console.log("The cpu load is " + cpu.load);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cpu)
+{
+ console.log("The cpu load is " + cpu.load);
+}
- function onErrorCallback(error) {
- console.log("An error occurred " + error.message);
- }
+function onErrorCallback(error)
+{
+ console.log("An error occurred " + error.message);
+}
- tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
- </pre>
+tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cellular) {
- console.log("The status of the cellular network is " + cellular.status);
- }
-
- function onErrorCallback(error) {
- console.log("An error occurred " + error.message);
- // if telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError would be passed.
- }
-
- var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
-
- if (telephony_capability === true) {
- // onSuccessCallback will be invoked.
- tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
- } else {
- console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cellular)
+{
+ console.log("The status of the cellular network is " + cellular.status);
+}
+
+function onErrorCallback(error)
+{
+ console.log("An error occurred " + error.message);
+ /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
+}
+
+var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
+
+if (telephony_capability === true)
+{
+ /* onSuccessCallback will be invoked */
+ tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
+}
+else
+{
+ console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getPropertyValueArray">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(property) {
- console.log("The SIM's current state is " + property.state);
- }
-
- function successArrayCB(properties) {
- console.log("The number of the returned system properties is " + properties.length);
- for (var i = 0; i < properties.length; i++) {
- console.log("[" + i + "] SIM's state is " + properties[i].state);
- }
- }
-
- var count = tizen.systeminfo.getCount("SIM");
- if (count === 0) {
- console.log("This device does not provide SIM card.");
- } else if (count > 1) {
- tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
- } else {
- tizen.systeminfo.getPropertyValue("SIM", successCB);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(property)
+{
+ console.log("The SIM's current state is " + property.state);
+}
+
+function successArrayCB(properties)
+{
+ console.log("The number of the returned system properties is " + properties.length);
+ for (var i = 0; i < properties.length; i++)
+ {
+ console.log("[" + i + "] SIM's state is " + properties[i].state);
+ }
+}
+
+var count = tizen.systeminfo.getCount("SIM");
+if (count === 0)
+{
+ console.log("This device does not provide SIM card.");
+}
+else if (count > 1)
+{
+ tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
+}
+else
+{
+ tizen.systeminfo.getPropertyValue("SIM", successCB);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::addPropertyValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cpu) {
- console.log("The cpu load : " + cpu.load);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cpu)
+{
+ console.log("The cpu load: " + cpu.load);
+}
- tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold : 0.2});
- </pre>
+tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2});
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::addPropertyValueArrayChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var id = null;
- function onSuccessCallback(cpu) {
- console.log("New value for CPU load is " + cpu.load);
- if (id != null) { // After receiving the first notification, we clear it
- tizen.systeminfo.removePropertyValueChangeListener(id);
- }
- }
-
- id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var id = null;
+function onSuccessCallback(cpu)
+{
+ console.log("New value for CPU load is " + cpu.load);
+ if (id != null)
+ {
+ /* After receiving the first notification, clear it */
+ tizen.systeminfo.removePropertyValueChangeListener(id);
+ }
+}
+
+id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.systeminfo.getPropertyValue("CAMERA_FLASH",
- function (flash) {
- console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
- },
- function (error) {
- console.log("Error, name: " + error.name + ", message: " + error.message);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
+{
+ console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
+}, function(error)
+{
+ console.log("Error, name: " + error.name + ", message: " + error.message);
+});
+</pre>
</div>
</li>
<li class="attribute" id="SystemInfoCameraFlash::camera">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.systeminfo.getPropertyValue("CAMERA_FLASH",
- function (flash) {
- try {
- flash.setBrightness(1);
- } catch (error) {
- console.log("Setting flash brightness failed: " + error.message);
- }
- },
- function (error) {
- console.log("Error, name: " + error.name + ", message: " + error.message);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
+{
+ try
+ {
+ flash.setBrightness(1);
+ }
+ catch (error)
+ {
+ console.log("Setting flash brightness failed: " + error.message);
+ }
+}, function(error)
+{
+ console.log("Error, name: " + error.name + ", message: " + error.message);
+});
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Checks whether SystemSetting API is supported.
- var systemsetting_api_supported = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Checks whether SystemSetting API is supported */
+var systemsetting_api_supported = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting");
- // Checks whether the picture on home screen can be changed or retrieved through SystemSetting API.
- var home_screen_system_setting = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen");
+/* Checks whether the picture on home screen can be changed or retrieved through SystemSetting API */
+var home_screen_system_setting = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen");
- // Defines the success callback.
- function successCallback() {
- console.log("Succeeded in changing the property");
- }
+/* Defines the success callback */
+function successCallback()
+{
+ console.log("Succeeded in changing the property");
+}
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Failed to change the property. Error : " + error.message);
- }
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Failed to change the property. Error: " + error.message);
+}
- if (systemsetting_api_supported === true) {
- // tizen.systemsetting will be available.
- if (home_screen_system_setting === true) {
- // Sets the home screen image.
- // The newHomeScreenImagePath variable should hold the path of the image to be set as home screen background
- tizen.systemsetting.setProperty("HOME_SCREEN", newHomeScreenImagePath, successCallback, errorCallback);
- } else {
- // if tizen.systemsetting.setProperty("HOME_SCREEN", ..) is invoked, NotSupportedError would be returned through ErrorCallback.
- }
- } else {
- // tizen.systemsetting will be 'undefined'.
- console.log("SystemSetting API is not supported on the device.");
- }
-
- </pre>
+if (systemsetting_api_supported === true)
+{
+ /* tizen.systemsetting will be available */
+ if (home_screen_system_setting === true)
+ {
+ /* Sets the home screen image */
+ /* newHomeScreenImagePath variable should hold the path of the image to be set as home screen background */
+ tizen.systemsetting.setProperty("HOME_SCREEN", newHomeScreenImagePath, successCallback, errorCallback);
+ }
+ else
+ {
+ /* if tizen.systemsetting.setProperty("HOME_SCREEN", ..) is invoked, NotSupportedError is returned through ErrorCallback */
+ }
+}
+else
+{
+ /* tizen.systemsetting will be 'undefined' */
+ console.log("SystemSetting API is not supported on the device.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemSettingManager::getProperty">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback
- function getPropertySuccessCallback(value) {
- // the case : tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen") returns 'true'.
- console.log("Succeeded in retrieving the property. The value is " + value);
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Failed to get the property. Error : " + error.message);
- // If the device does not support to get the image on home screen, NotSupportedError would be thrown.
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+function getPropertySuccessCallback(value)
+{
+ /* Case: tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen") returns 'true' */
+ console.log("Succeeded in retrieving the property. The value is " + value);
+}
- tizen.systemsetting.getProperty("HOME_SCREEN", getPropertySuccessCallback, errorCallback);
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Failed to get the property. Error: " + error.message);
+ /* If the device does not support to get the image on home screen, NotSupportedError is thrown */
+}
- </pre>
+tizen.systemsetting.getProperty("HOME_SCREEN", getPropertySuccessCallback, errorCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var current_dt = tizen.time.getCurrentDateTime();
+console.log("current date/time is " + current_dt.toLocaleString());
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getLocalTimezone">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The local time zone is " + tizen.time.getLocalTimezone());
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log("The local time zone is " + tizen.time.getLocalTimezone());
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Note that it is possible to get the time zone description in other formats, e.g. by calling:
- now = new tizen.TZDate(new Date(), 'Asia/Manila');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Note that it is possible to get the time zone description in other formats, e.g. by calling */
+now = new tizen.TZDate(new Date(), 'Asia/Manila');
- // Outputs "Wednesday, January 27, 2016, 8:46:00 PM GMT+0800 Philippines Time"
- console.log(now.toString());
- </pre>
+/* Outputs "Wednesday, January 27, 2016, 8:46:00 PM GMT+0800 Philippines Time" */
+console.log(now.toString());
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getAvailableTimezones">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var tzids = tizen.time.getAvailableTimezones();
- console.log("The device supports " + tzids.length + " time zones.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var tzids = tizen.time.getAvailableTimezones();
+console.log("The device supports " + tzids.length + " time zones.");
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var tzids = tizen.time.getAvailableTimezones();
- var currentLocation = 'Europe/Berlin';
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var tzids = tizen.time.getAvailableTimezones();
+var currentLocation = 'Europe/Berlin';
- // checks whether an entry 'Europe/Berlin' exists in the array.
- if (tzids.indexOf(currentLocation) > -1) {
- console.log('The device supports ' + currentLocation + ' timezone.');
- } else {
- console.log('The device does not support ' + currentLocation + ' timezone.');
- }
- </pre>
+/* Checks whether an entry 'Europe/Berlin' exists in the array */
+if (tzids.indexOf(currentLocation) > -1)
+{
+ console.log('The device supports ' + currentLocation + ' timezone.');
+}
+else
+{
+ console.log('The device does not support ' + currentLocation + ' timezone.');
+}
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getDateFormat">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the long date format, e.g. "D, M d y".
- var dateFormat = tizen.time.getDateFormat();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the long date format, e.g. "D, M d y" */
+var dateFormat = tizen.time.getDateFormat();
- // Gets the short date format, e.g. "d/m/y".
- var shortDateFormat = tizen.time.getDateFormat(true);
+/* Gets the short date format, e.g. "d/m/y" */
+var shortDateFormat = tizen.time.getDateFormat(true);
- console.log("Long date format: " + dateFormat);
- </pre>
+console.log("Long date format: " + dateFormat);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getTimeFormat">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the time format, e.g. "h:m:s ap".
- var timeFormat = tizen.time.getTimeFormat();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the time format, e.g. "h:m:s ap" */
+var timeFormat = tizen.time.getTimeFormat();
- console.log(timeFormat);
- </pre>
+console.log(timeFormat);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::isLeapYear">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var current_dt = tizen.time.getCurrentDateTime();
- var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
- if (is_leap) {
- console.log("This year is a leap year.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var current_dt = tizen.time.getCurrentDateTime();
+var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
+if (is_leap)
+{
+ console.log("This year is a leap year.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::setDateTimeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
-
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setDateTimeChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setDateTimeChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::unsetDateTimeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- tizen.time.unsetDateTimeChangeListener();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setDateTimeChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ tizen.time.unsetDateTimeChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setDateTimeChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::setTimezoneChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- // The new time zone can be retrieved through tizen.time.getLocalTimezone()
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setTimezoneChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setTimezoneChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::unsetTimezoneChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- tizen.time.unsetTimezoneChangeListener();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setTimezoneChangeListener(changedCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ tizen.time.unsetTimezoneChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setTimezoneChangeListener(changedCallback);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a new TZDate object with current date/time and timezone:
- var now = new tizen.TZDate();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a new TZDate object with current date/time and timezone */
+var now = new tizen.TZDate();
- // Creates a new TZDate object with date set to 1st of January 2016 in time zone for Germany:
- var newYear = new tizen.TZDate(new Date("2016-01-01"), 'Europe/Berlin');
+/* Creates a new TZDate object with date set to 1st of January 2016 in time zone for Germany */
+var newYear = new tizen.TZDate(new Date("2016-01-01"), 'Europe/Berlin');
- // Creates a new TZDate object with values set explicitly:
- var myDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/Berlin');
- </pre>
+/* Creates a new TZDate object with values set explicitly */
+var myDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/Berlin');
+</pre>
</div>
</dl>
</div>
long The day of the month.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getDate()); // should output 31.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getDate()); /* Outputs 31 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setDate">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setDate(1); // Changes the day of month to 1.
- console.log(someDate.getDate()); // should output 1.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setDate(1); /* Changes the day of month to 1 */
+console.log(someDate.getDate()); /* Outputs 1 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getDay">
long The day of the week
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getDay()); // should output "5", because 31st of December 1999 was friday.
-
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getDay()); /* Outputs "5", because 31st of December 1999 was Friday */
</pre>
</div>
</dd>
long The year
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getFullYear()); // should output 1999.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getFullYear()); /* Outputs 1999 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setFullYear">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setFullYear(2099); // Changes the year to 2099.
- console.log(someDate.getFullYear()); // should output 2099.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setFullYear(2099); /* Changes the year to 2099 */
+console.log(someDate.getFullYear()); /* Outputs 2099 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getHours">
long The hour
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getHours()); // should output 23.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getHours()); /* Outputs 23 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setHours">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setHours(15); // Sets the hour to 3 PM.
- console.log(someDate.getHours()); // should output 15.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setHours(15); /* Sets the hour to 3 PM */
+console.log(someDate.getHours()); /* Outputs 15 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getMilliseconds">
long The milliseconds
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getMilliseconds()); // should output 999.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getMilliseconds()); /* Outputs 999 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setMilliseconds">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setMilliseconds(42);
- console.log(someDate.getMilliseconds()); // should output 42.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setMilliseconds(42);
+console.log(someDate.getMilliseconds()); /* Outputs 42 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getMinutes">
long The minutes
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getMinutes()); // should output 59.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getMinutes()); /* Outputs 59 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setMinutes">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setMinutes(58);
- console.log(someDate.getMinutes()); // should output 58.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setMinutes(58);
+console.log(someDate.getMinutes()); /* Outputs 58 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getMonth">
long The month
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getMonth()); // should output 11.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getMonth()); /* Outputs 11 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setMonth">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setMonth(2); // Changes the month to March.
- console.log(someDate.getMonth()); // should output 2.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setMonth(2); /* Changes the month to March */
+console.log(someDate.getMonth()); /* Outputs 2 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getSeconds">
long The seconds
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getSeconds()); // should output 59.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getSeconds()); /* Outputs 59 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setSeconds">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setSeconds(23);
- console.log(someDate.getSeconds()); // should output 23.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setSeconds(23);
+console.log(someDate.getSeconds()); /* Outputs 23 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getUTCDate">
long The day of the month, according to universal time
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getUTCDate()); // should output 31.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getUTCDate()); /* Outputs 31 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setUTCDate">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setUTCDate(5) // Change the day of month to 5th.
- console.log(someDate.getUTCDate()); // should output 5.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setUTCDate(5) /* Change the day of month to 5th */
+console.log(someDate.getUTCDate()); /* Outputs 5 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getUTCDay">
long The day of the week, according to universal time
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getUTCDay()); // should output 5, since 31st of December 1999 was friday.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getUTCDay()); /* Outputs 5, since 31st of December 1999 was Friday */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getUTCFullYear">
long The year, according to universal time
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getUTCFullYear()); // should output 1999.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getUTCFullYear()); /* Outputs 1999 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setUTCFullYear">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setUTCFullYear(2099); // Change the year to 2099, universal time.
- console.log(someDate.getUTCFullYear()); // should output 2099.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setUTCFullYear(2099); /* Change the year to 2099, universal time */
+console.log(someDate.getUTCFullYear()); /* Outputs 2099 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getUTCHours">
long The hour, according to universal time
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getUTCHours()); // should output 23.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getUTCHours()); /* Outputs 23 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setUTCHours">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setUTCHours(15);
- console.log(someDate.getUTCHours()); // should output 15.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setUTCHours(15);
+console.log(someDate.getUTCHours()); /* Outputs 15 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getUTCMilliseconds">
long The milliseconds, according to universal time
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getUTCMilliseconds()); // should output 999.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getUTCMilliseconds()); /* Outputs 999 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setUTCMilliseconds">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setUTCMillisecond(42);
- console.log(someDate.getUTCMilliseconds()); // should output 42.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setUTCMillisecond(42);
+console.log(someDate.getUTCMilliseconds()); /* Outputs 42 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getUTCMinutes">
long The minutes, according to universal time
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getUTCMinutes()); // should output 59.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getUTCMinutes()); /* Outputs 59 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setUTCMinutes">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setUTCMinutes(58);
- console.log(someDate.getUTCMinutes()); // should output 58.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setUTCMinutes(58);
+console.log(someDate.getUTCMinutes()); /* Outputs 58 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getUTCMonth">
long The month, according to universal time
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getUTCMonth()); // should output 11.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getUTCMonth()); /* Outputs 11 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setUTCMonth">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setUTCMonth(2); // Sets the month to March, according to the universal time.
- console.log(someDate.getUTCMonth()); // should output 2.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setUTCMonth(2); /* Sets the month to March, according to the universal time */
+console.log(someDate.getUTCMonth()); /* Outputs 2 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getUTCSeconds">
long The seconds, according to universal time
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getUTCSeconds()); // should output 59.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getUTCSeconds()); /* Outputs 59 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::setUTCSeconds">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- someDate.setUTCSeconds(23);
- console.log(someDate.getUTCSeconds()); // should output 23.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+someDate.setUTCSeconds(23);
+console.log(someDate.getUTCSeconds()); /* Outputs 23 */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getTimezone">
DOMString The string timezone identifier <br>If TZDate is invalid, it will return 'Invalid Date'.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- console.log(someDate.getTimezone()); // should output "Europe/London".
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+console.log(someDate.getTimezone()); /* Outputs "Europe/London" */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toTimezone">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- var koreanDate = someDate.toTimezone("Asia/Seoul");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+var koreanDate = someDate.toTimezone("Asia/Seoul");
- // Should output: "Saturday, January 1, 2000, 8:59:59 AM GMT+0900 South Korea Time"
- console.log(someDate.toString());
- </pre>
+/* Output: "Saturday, January 1, 2000, 8:59:59 AM GMT+0900 South Korea Time" */
+console.log(someDate.toString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toLocalTimezone">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // This example assumes that the device's local time zone is set to Asia/Seoul.
- // You may get different results depending on your local time zone settings.
- var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
- var localDate = someDate.toLocalTimezone();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ This example assumes that the device's local time zone is set to Asia/Seoul
+ You may get different results depending on your local time zone settings
+*/
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
+var localDate = someDate.toLocalTimezone();
- // Should output: "Saturday, January 1, 2000, 8:59:59 AM GMT+0900 South Korea Time"
- console.log(localDate.toString());
- </pre>
+/* Output: "Saturday, January 1, 2000, 8:59:59 AM GMT+0900 South Korea Time" */
+console.log(localDate.toString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toUTC">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Asia/Seoul");
- var utcDate = someDate.toUTC();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Asia/Seoul");
+var utcDate = someDate.toUTC();
- // Should output: "Friday, December 31, 1999, 2:59:59 PM GMT+0000 GMT"
- console.log(utcDate.toString());
- </pre>
+/* Output: "Friday, December 31, 1999, 2:59:59 PM GMT+0000 GMT" */
+console.log(utcDate.toString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::difference">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Prepares two TZDates pointing at new year eves in 2011 and 2012, respectively:
- var newYearEve2011 = new tizen.TZDate(2011, 0, 0, 0, 0, 0, 0, "Europe/London");
- var newYearEve2012 = new tizen.TZDate(2012, 0, 0, 0, 0, 0, 0, "Europe/London");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Prepares two TZDates pointing at new year eves in 2011 and 2012, respectively */
+var newYearEve2011 = new tizen.TZDate(2011, 0, 0, 0, 0, 0, 0, "Europe/London");
+var newYearEve2012 = new tizen.TZDate(2012, 0, 0, 0, 0, 0, 0, "Europe/London");
- // Calculates how much is the difference between those two dates:
- var difference = newYearEve2012.difference(newYearEve2011);
+/* Calculates how much is the difference between those two dates */
+var difference = newYearEve2012.difference(newYearEve2011);
- // Should output: "The difference is 365 DAYS" (since none of those dates have time component)
- console.log("The difference is " + difference.length + " " + difference.unit);
- </pre>
+/* Output: "The difference is 365 DAYS" (since none of those dates have time component) */
+console.log("The difference is " + difference.length + " " + difference.unit);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Prepares two TZDates pointing at 6:00 PM and 8:00 PM on the same day:
- var joggingStart = new tizen.TZDate(2015, 6, 6, 18, 0, 0, 0, "Europe/London");
- var joggingEnd = new tizen.TZDate(2015, 6, 6, 20, 0, 0, 0, "Europe/London");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Prepares two TZDates pointing at 6:00 PM and 8:00 PM on the same day */
+var joggingStart = new tizen.TZDate(2015, 6, 6, 18, 0, 0, 0, "Europe/London");
+var joggingEnd = new tizen.TZDate(2015, 6, 6, 20, 0, 0, 0, "Europe/London");
- // Calculates how much is the difference between those two dates:
- var difference = joggingEnd.difference(joggingStart);
+/* Calculates how much is the difference between those two dates */
+var difference = joggingEnd.difference(joggingStart);
- // Should output: "The difference is 7200000 MSECS" (since both of those dates do have time component)
- console.log("The difference is " + difference.length + " " + difference.unit);
- </pre>
+/* Output: "The difference is 7200000 MSECS" (since both of those dates do have time component) */
+console.log("The difference is " + difference.length + " " + difference.unit);
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::equalsTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var noonInEngland = new tizen.TZDate(2016, 0, 27, 12, 0, 0, 0, 'Europe/London');
- var sameTimeInKorea = noonInEngland.toTimezone('Asia/Seoul');
- var isTheSame = noonInEngland.equalsTo(sameTimeInKorea);
-
- // Those are the same dates (in different time zones), so the output should be "Those dates are equal."
- if(isTheSame) {
- console.log("Those dates are equal.");
- } else {
- console.log("Those dates are not equal.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var noonInEngland = new tizen.TZDate(2016, 0, 27, 12, 0, 0, 0, 'Europe/London');
+var sameTimeInKorea = noonInEngland.toTimezone('Asia/Seoul');
+var isTheSame = noonInEngland.equalsTo(sameTimeInKorea);
+
+/* Those are the same dates (in different time zones), so the output should be "Those dates are equal." */
+if (isTheSame)
+{
+ console.log("Those dates are equal.");
+}
+else
+{
+ console.log("Those dates are not equal.");
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var noonInEngland = new tizen.TZDate(2016, 0, 27, 12, 0, 0, 0, 'Europe/London');
- var noonInKorea = new tizen.TZDate(2016, 0, 27, 12, 0, 0, 0, 'Asia/Seoul');
- var isTheSame = noonInEngland.equalsTo(noonInKorea);
-
- // Those are not the same dates (obviously, noon in London is not noon in Seoul),
- // so the output should be "Those dates are not equal."
- if(isTheSame) {
- console.log("Those dates are equal.");
- } else {
- console.log("Those dates are not equal.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var noonInEngland = new tizen.TZDate(2016, 0, 27, 12, 0, 0, 0, 'Europe/London');
+var noonInKorea = new tizen.TZDate(2016, 0, 27, 12, 0, 0, 0, 'Asia/Seoul');
+var isTheSame = noonInEngland.equalsTo(noonInKorea);
+
+/*
+ Those are not the same dates (obviously, noon in London is not noon in Seoul),
+ so the output should be "Those dates are not equal."
+*/
+if (isTheSame)
+{
+ console.log("Those dates are equal.");
+}
+else
+{
+ console.log("Those dates are not equal.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::earlierThan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Create a new TZDate object pointing to noon in London:
- var tzd1 = new tizen.TZDate(2016, 0, 1, 12, 0, 0, 0, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Create a new TZDate object pointing to noon in London */
+var tzd1 = new tizen.TZDate(2016, 0, 1, 12, 0, 0, 0, 'Europe/London');
- // Create a new TZDate object pointing to 6 PM in Seoul on the same day:
- var tzd2 = new tizen.TZDate(2016, 0, 1, 18, 0, 0, 0, 'Asia/Seoul');
+/* Create a new TZDate object pointing to 6 PM in Seoul on the same day */
+var tzd2 = new tizen.TZDate(2016, 0, 1, 18, 0, 0, 0, 'Asia/Seoul');
- // is 12:00 local time in London earlier than 18:00 local time in Seoul?
- var isEarlier = tzd1.earlierThan(tzd2);
+/* Is 12:00 local time in London earlier than 18:00 local time in Seoul? */
+var isEarlier = tzd1.earlierThan(tzd2);
- // should output 'false', since local time in Seoul is GMT (London) + 9 hours.
- console.log(isEarlier);
- </pre>
+/* Outputs 'false', since local time in Seoul is GMT (London) + 9 hours */
+console.log(isEarlier);
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::laterThan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Create a new TZDate object pointing to noon in London:
- var tzd1 = new tizen.TZDate(2016, 0, 1, 12, 0, 0, 0, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Create a new TZDate object pointing to noon in London */
+var tzd1 = new tizen.TZDate(2016, 0, 1, 12, 0, 0, 0, 'Europe/London');
- // Create a new TZDate object pointing to 6 PM in Seoul on the same day:
- var tzd2 = new tizen.TZDate(2016, 0, 1, 18, 0, 0, 0, 'Asia/Seoul');
+/* Create a new TZDate object pointing to 6 PM in Seoul on the same day */
+var tzd2 = new tizen.TZDate(2016, 0, 1, 18, 0, 0, 0, 'Asia/Seoul');
- // is 12:00 local time in London earlier than 18:00 local time in Seoul?
- var isLater = tzd1.laterThan(tzd2);
+/* Is 12:00 local time in London earlier than 18:00 local time in Seoul? */
+var isLater = tzd1.laterThan(tzd2);
- // should output 'true', since local time in Seoul is GMT (London) + 9 hours.
- console.log(isLater);
- </pre>
+/* Outputs 'true', since local time in Seoul is GMT (London) + 9 hours */
+console.log(isLater);
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::addDuration">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var now = tizen.time.getCurrentDateTime();
- var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var now = tizen.time.getCurrentDateTime();
+var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toLocaleDateString">
DOMString The date portion of the TZDate object as a string, using locale conventions <br>If TZDate is invalid, it will return 'Invalid Date'.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
- // Output example (depends on locale settings): "Friday, December 31, 1999"
- console.log(someDate.toLocaleDateString());
- </pre>
+/* Output example (depends on locale settings): "Friday, December 31, 1999" */
+console.log(someDate.toLocaleDateString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toLocaleTimeString">
DOMString The time portion of the TZDate object as a string, using locale conventions <br>If TZDate is invalid, it will return 'Invalid Date'.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
- // Output example (depends on locale settings): "11:59:59 PM"
- console.log(someDate.toLocaleTimeString());
- </pre>
+/* Output example (depends on locale settings): "11:59:59 PM" */
+console.log(someDate.toLocaleTimeString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toLocaleString">
DOMString The string representation of the TZDate object, using locale conventions <br>If TZDate is invalid, it will return 'Invalid Date'.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
- // Output example (depends on locale settings): "Friday, December 31, 1999, 11:59:59 PM"
- console.log(someDate.toLocaleString());
- </pre>
+/* Output example (depends on locale settings): "Friday, December 31, 1999, 11:59:59 PM" */
+console.log(someDate.toLocaleString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toDateString">
DOMString The date portion of the TZDate object as a string <br>If TZDate is invalid, it will return 'Invalid Date'.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
- // Should output: "Friday, December 31, 1999"
- console.log(someDate.toDateString());
- </pre>
+/* Output: "Friday, December 31, 1999" */
+console.log(someDate.toDateString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toTimeString">
DOMString The time portion of the TZDate object as a string <br>If TZDate is invalid, it will return 'Invalid Date'.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
- // Should output: "11:59:59 PM GMT+0000 United Kingdom Time"
- console.log(someDate.toTimeString());
- </pre>
+/* Output: "11:59:59 PM GMT+0000 United Kingdom Time" */
+console.log(someDate.toTimeString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toString">
DOMString The string representation of the TZDate object <br>If TZDate is invalid, it will return 'Invalid Date'.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
- // Should output: "Friday, December 31, 1999, 11:59:59 PM GMT+0000 United Kingdom Time"
- console.log(someDate.toString());
- </pre>
+/* Output: "Friday, December 31, 1999, 11:59:59 PM GMT+0000 United Kingdom Time" */
+console.log(someDate.toString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getTimezoneAbbreviation">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
- var myDate = new Date();
- var exp_offset = myDate.getTimezoneOffset()*60;
- //offset is equals to exp_offset.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
+var myDate = new Date();
+var exp_offset = myDate.getTimezoneOffset() * 60;
+/* offset is equal to exp_offset */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::isDST">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var summertime = new tizen.TZDate(2015, 6, 1, 10, 0, 0, 0, 'Europe/London');
- var wintertime = new tizen.TZDate(2015, 0, 1, 10, 0, 0, 0, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var summertime = new tizen.TZDate(2015, 6, 1, 10, 0, 0, 0, 'Europe/London');
+var wintertime = new tizen.TZDate(2015, 0, 1, 10, 0, 0, 0, 'Europe/London');
- var isDstActiveInSummer = summertime.isDST(); // true
- var isDstActiveInWinter = wintertime.isDST(); // false
- </pre>
+var isDstActiveInSummer = summertime.isDST(); /* true */
+var isDstActiveInWinter = wintertime.isDST(); /* false */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getPreviousDSTTransition">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates the TZDate object pointing to January 2016.
- var winter16 = new tizen.TZDate(2016, 0, 1, 10, 0, 0, 0, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates the TZDate object pointing to January 2016 */
+var winter16 = new tizen.TZDate(2016, 0, 1, 10, 0, 0, 0, 'Europe/London');
- // Gets the date of previous DST transition:
- var previousDstTransition = winter16.getPreviousDSTTransition();
+/* Gets the date of previous DST transition */
+var previousDstTransition = winter16.getPreviousDSTTransition();
- // Should output: "Sunday, October 25, 2015, 1:00:00 AM GMT+0000 United Kingdom Time"
- console.log(previousDstTransition.toString());
- </pre>
+/* Output: "Sunday, October 25, 2015, 1:00:00 AM GMT+0000 United Kingdom Time" */
+console.log(previousDstTransition.toString());
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::getNextDSTTransition">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates the TZDate object pointing to January 2016.
- var winter16 = new tizen.TZDate(2016, 0, 1, 10, 0, 0, 0, 'Europe/London');
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates the TZDate object pointing to January 2016 */
+var winter16 = new tizen.TZDate(2016, 0, 1, 10, 0, 0, 0, 'Europe/London');
- // Gets the date of next DST transition:
- var nextDstTransition = winter16.getNextDSTTransition();
+/* Gets the date of next DST transition */
+var nextDstTransition = winter16.getNextDSTTransition();
- // Should output: "Sunday, March 27, 2016, 2:00:00 AM GMT+0100 United Kingdom Time"
- console.log(nextDstTransition.toString());
- </pre>
+/* Output: "Sunday, March 27, 2016, 2:00:00 AM GMT+0100 United Kingdom Time" */
+console.log(nextDstTransition.toString());
+</pre>
</div>
</dd>
</dl>
</div>
<pre class="webidl prettyprint">TimeDuration(long long length, optional <a href="#TimeDurationUnit">TimeDurationUnit</a>? unit);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var now = tizen.time.getCurrentDateTime();
- var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); // Becomes tomorrow, same time.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var now = tizen.time.getCurrentDateTime();
+var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); /* Becomes tomorrow, same time */
+</pre>
</div>
</dl>
</div>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
- // Changing both length and unit of existing TimeDuration objects is possible:
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Changing both length and unit of existing TimeDuration objects is possible */
- var now = tizen.time.getCurrentDateTime();
- var threeHours = new tizen.TimeDuration();
- threeHours.length = 3;
- threeHours.unit = "HOURS";
- var later = now.addDuration(threeHours); // later points to a time three hours from now.
- </pre>
+var now = tizen.time.getCurrentDateTime();
+var threeHours = new tizen.TimeDuration();
+threeHours.length = 3;
+threeHours.unit = "HOURS";
+var later = now.addDuration(threeHours); /* later points to a time three hours from now */
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Assume that event1 and event2 are tizen.CalendarEvent objects.
- // Computes event1.duration - event2.duration
- var diff = event1.duration.difference(event2.duration);
- if (diff.length > 0)
- console.log("The event1 is longer than event2.");
- else if (diff.length == 0)
- console.log("The duration of two events is same.");
- else
- console.log("The event1 is shorter than the event2.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assume that event1 and event2 are tizen.CalendarEvent objects */
+/* Computes event1.duration - event2.duration */
+var diff = event1.duration.difference(event2.duration);
+if (diff.length > 0)
+ console.log("The event1 is longer than event2.");
+else if (diff.length == 0)
+ console.log("The duration of two events is same.");
+else
+ console.log("The event1 is shorter than the event2.");
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::equalsTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(60, "MINS"); // 60 minutes
- var d2 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var ret = d1.equalsTo(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(60, "MINS"); /* 60 minutes */
+var d2 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var ret = d1.equalsTo(d2); /* Returns true */
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::lessThan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var d2 = new tizen.TimeDuration(120, "MINS"); // 120 minutes
- var ret = d1.lessThan(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var d2 = new tizen.TimeDuration(120, "MINS"); /* 120 minutes */
+var ret = d1.lessThan(d2); /* Returns true */
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::greaterThan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(120, "MINS"); // 120 minutes
- var d2 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var ret = d1.greaterThan(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(120, "MINS"); /* 120 minutes */
+var d2 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var ret = d1.greaterThan(d2); /* Returns true */
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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);
+</pre>
</div>
<div class="constructors">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> 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);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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);
+</pre>
</div>
<div class="constructors">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example retrieves all songs from the album "Tormato" and all songs by artist "Rush".
- var count = 100;
- var offset = 0;
- var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "Rush");
- var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "Tormato");
- var filter = new tizen.CompositeFilter("UNION", [albumFilter, artistFilter]);
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function findCB(contents) {
- console.log('Songs found:' + contents.length);
- }
-
- tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example retrieves all songs from the album "Tormato" and all songs by artist "Rush" */
+var count = 100;
+var offset = 0;
+var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "Rush");
+var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "Tormato");
+var filter = new tizen.CompositeFilter("UNION", [albumFilter, artistFilter]);
+
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function findCB(contents)
+{
+ console.log('Songs found:' + contents.length);
+}
+
+tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
+</pre>
</div>
<div class="constructors">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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);
+</pre>
</div>
<div class="constructors">
<h4 id="SortMode::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // This example utilizes methods from Tizen's HAM module to get current latitude and longitude.
- var myPosition;
-
- // reads current position from the GPS module.
- function onChangedCB(info) {
- var latitude, longitude;
- latitude = info.gpsInfo[0].latitude;
- longitude = info.gpsInfo[0].longitude;
-
- // packs these values in one variable:
- myPosition = new SimpleCoordinates(latitude, longitude);
- }
-
- // starts monitoring GPS info periodically.
- try {
- tizen.humanactivitymonitor.start("GPS", onChangedCB, {callbackInterval: 120000, sampleInterval: 60000});
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* This example utilizes methods from Tizen's HAM module to get current latitude and longitude */
+var myPosition;
+
+/* Reads current position from the GPS module */
+function onChangedCB(info)
+{
+ var latitude, longitude;
+ latitude = info.gpsInfo[0].latitude;
+ longitude = info.gpsInfo[0].longitude;
+
+ /* Packs these values in one variable */
+ myPosition = new SimpleCoordinates(latitude, longitude);
+}
+
+/* Starts monitoring GPS info periodically */
+try
+{
+ tizen.humanactivitymonitor.start("GPS", onChangedCB, {callbackInterval: 120000, sampleInterval: 60000});
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
<div class="constructors">
<h4 id="SimpleCoordinates::constructor">Constructors</h4>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
- function onSuccess() {
- console.log("Application launched successfully");
- }
+function onSuccess()
+{
+ console.log("Application launched successfully");
+}
- var app = tizen.application.getCurrentApplication();
- var appid = app.appInfo.id;
+var app = tizen.application.getCurrentApplication();
+var appid = app.appInfo.id;
- tizen.application.launch(appid, onSuccess);
+tizen.application.launch(appid, onSuccess);
</pre>
</div>
<div class="methods">
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
- // Define the error callback:
- function onError(error) {
- console.log(error.message);
- }
+/* Define the error callback */
+function onError(error)
+{
+ console.log(error.message);
+}
- function onSuccess() {
- console.log("Application launched successfully");
- }
+function onSuccess()
+{
+ console.log("Application launched successfully");
+}
- var app = tizen.application.getCurrentApplication();
- var appid = app.appInfo.id;
+var app = tizen.application.getCurrentApplication();
+var appid = app.appInfo.id;
- tizen.application.launch(appid, onSuccess, onError);
+tizen.application.launch(appid, onSuccess, onError);
</pre>
</div>
<div class="methods">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCallback() {
- console.log("The requested user agent string has just been set successfully.");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCallback()
+{
+ console.log("The requested user agent string has just been set successfully.");
+}
- tizen.websetting.setUserAgentString("the new user agent string to set", successCallback);
- </pre>
+tizen.websetting.setUserAgentString("the new user agent string to set", successCallback);
+</pre>
</div>
</dd>
<dt class="method" id="WebSettingManager::removeAllCookies">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCallback() {
- console.log("The cookies saved for your application have just been removed.");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCallback()
+{
+ console.log("The cookies saved for your application have just been removed.");
+}
- tizen.websetting.removeAllCookies(successCallback);
- </pre>
+tizen.websetting.removeAllCookies(successCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- console.log("Widget id is " + myWidget.id);
- console.log("Widget details:");
- console.log("Main application id: " + myWidget.applicationId);
- console.log("Package id: " + myWidget.packageId);
- console.log("Is hidden in the list of widgets: " + myWidget.noDisplay);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ console.log("Widget id is " + myWidget.id);
+ console.log("Widget details:");
+ console.log("Main application id: " + myWidget.applicationId);
+ console.log("Package id: " + myWidget.packageId);
+ console.log("Is hidden in the list of widgets: " + myWidget.noDisplay);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Widget id is org.tizen.gallery.widget
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.widgetservice.getWidgets(function (widgets) {
- console.log("There are " + widgets.length + " available widgets");
- }, function (error) {
- console.log("Error: " + error.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.widgetservice.getWidgets(function(widgets)
+{
+ console.log("There are " + widgets.length + " available widgets");
+}, function(error)
+{
+ console.log("Error: " + error.message);
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> There are 3 available widgets
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable id should contain valid id of the application or package.
- var id = "org.tizen.gallery";
- try {
- var widgetId = tizen.widgetservice.getPrimaryWidgetId(id);
- console.log("Widget id is " + widgetId);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable id should contain valid id of the application or package */
+var id = "org.tizen.gallery";
+try
+{
+ var widgetId = tizen.widgetservice.getPrimaryWidgetId(id);
+ console.log("Widget id is " + widgetId);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Widget id is org.tizen.gallery.widget
</dt>
<dd>
<div class="brief">
- Returns the size coresponding to the given sizeType.
+ Returns the size corresponding to the given sizeType.
</div>
<div class="synopsis"><pre class="signature prettyprint"><a href="#WidgetSize">WidgetSize</a> getSize(<a href="#WidgetSizeType">WidgetSizeType</a> sizeType);
</pre></div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable sizeType should contain supported size type
- var sizeType = "4x4";
- try {
- var widgetSize = tizen.widgetservice.getSize(sizeType);
- console.log("Widget size width: " + widgetSize.width + ", height: " + widgetSize.height);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable sizeType should contain supported size type */
+var sizeType = "4x4";
+try
+{
+ var widgetSize = tizen.widgetservice.getSize(sizeType);
+ console.log("Widget size width: " + widgetSize.width + ", height: " + widgetSize.height);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Widget size width: 712, height: 712
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- var name = myWidget.getName("en-us");
- console.log("Widget name is " + name);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var name = myWidget.getName("en-us");
+ console.log("Widget name is " + name);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Widget name is Gallery
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> widgetSuccessCb = function(instances) {
- console.log("Instances array size: " + instances.length);
- }
-
- widgetErrorCb = function(error) {
- console.log("Error occurred: " + error.name + ": " + error.message);
- }
-
- //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- myWidget.getInstances(widgetSuccessCb, widgetErrorCb);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+widgetSuccessCb = function(instances)
+{
+ console.log("Instances array size: " + instances.length);
+}
+
+widgetErrorCb = function(error)
+{
+ console.log("Error occurred: " + error.name + ": " + error.message);
+}
+
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ myWidget.getInstances(widgetSuccessCb, widgetErrorCb);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Instances array size: 3
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- var variant = myWidget.getVariant("4x4");
- console.log("Variant preview image path is " + variant.previewImagePath);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var variant = myWidget.getVariant("4x4");
+ console.log("Variant preview image path is " + variant.previewImagePath);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Variant preview image path is /usr/share/icons/default/small/preview_gallery_4x4.png
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> widgetSuccessCb = function(variants) {
- console.log("Variants array size: " + variants.length);
- }
-
- widgetErrorCb = function(error) {
- console.log("Error occurred: " + error.name + ": " + error.message);
- }
-
- //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- myWidget.getVariants(widgetSuccessCb, widgetErrorCb);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+widgetSuccessCb = function(variants)
+{
+ console.log("Variants array size: " + variants.length);
+}
+
+widgetErrorCb = function(error)
+{
+ console.log("Error occurred: " + error.name + ": " + error.message);
+}
+
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ myWidget.getVariants(widgetSuccessCb, widgetErrorCb);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Variants array size: 4
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> widgetChangeCb = function(instance, event) {
- console.log("Instance " + instance.id + " is " + event);
- }
-
- //variable id should contain valid id of the installed widget
- var id = "org.tizen.music-player.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- var watchId = myWidget.addStateChangeListener(widgetChangeCb);
- console.log("Listener with id " + watchId + " has been added");
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+widgetChangeCb = function(instance, event)
+{
+ console.log("Instance " + instance.id + " is " + event);
+}
+
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.music-player.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var watchId = myWidget.addStateChangeListener(widgetChangeCb);
+ console.log("Listener with id " + watchId + " has been added");
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Listener with id 1 has been added.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> widgetChangeCb = function(instance, event) {
- console.log("Instance " + instance.id + " is " + event);
- myWidget.removeStateChangeListener(watchId);
- console.log("Listener with id " + watchId + " has been removed");
- }
-
- //variable id should contain valid id of the installed widget
- var id = "org.tizen.music-player.widget";
- var watchId;
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- watchId = myWidget.addStateChangeListener(widgetChangeCb);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+widgetChangeCb = function(instance, event)
+{
+ console.log("Instance " + instance.id + " is " + event);
+ myWidget.removeStateChangeListener(watchId);
+ console.log("Listener with id " + watchId + " has been removed");
+}
+
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.music-player.widget";
+var watchId;
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ watchId = myWidget.addStateChangeListener(widgetChangeCb);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Listener with id 1 has been removed.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable instance should contain valid WidgetInstance object obtained by getInstances() method.
- var instance;
- var period = 2;
-
- try {
- instance.changeUpdatePeriod(period);
- console.log("Update period has been set to " + period + " seconds");
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable instance should contain valid WidgetInstance object obtained by getInstances() method */
+var instance;
+var period = 2;
+
+try
+{
+ instance.changeUpdatePeriod(period);
+ console.log("Update period has been set to " + period + " seconds");
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Update period has been set to 2 seconds.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable instance should contain valid WidgetInstance object obtained by getInstances() method.
- var instance;
-
- var data = {
- data1 : 'test1',
- data2 : 'test2'
- };
-
- try {
- instance.sendContent(data, true);
- console.log("Data has been successfully sent");
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable instance should contain valid WidgetInstance object obtained by getInstances() method */
+var instance;
+
+var data =
+{
+ data1: 'test1',
+ data2: 'test2'
+};
+
+try
+{
+ instance.sendContent(data, true);
+ console.log("Data has been successfully sent");
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Data has been successfully sent
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable instance should contain valid WidgetInstance object obtained by getInstances() method.
- var instance;
-
- contentSuccessCb = function(data) {
- console.log("Data has been obtained successfully");
- for (var prop in data) {
- console.log(prop + " : " + data[prop]);
- }
- }
-
- contentErrorCb = function(error) {
- console.log("Error occurred: " + error.name + ":" + error.message);
- }
-
- try {
- instance.getContent(contentSuccessCb, contentErrorCb);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable instance should contain valid WidgetInstance object obtained by getInstances() method */
+var instance;
+
+contentSuccessCb = function(data)
+{
+ console.log("Data has been obtained successfully");
+ for (var prop in data)
+ {
+ console.log(prop + ": " + data[prop]);
+ }
+}
+
+contentErrorCb = function(error)
+{
+ console.log("Error occurred: " + error.name + ":" + error.message);
+}
+
+try
+{
+ instance.getContent(contentSuccessCb, contentErrorCb);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Data has been obtained successfully
- data1 : test1
- data2 : test2
+ data1: test1
+ data2: test2
</pre>
</div>
</dd>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Triggers an alarm on a given date/time
- var alarm = new tizen.AlarmAbsolute(new Date(2014, 10, 4, 8, 0));
- var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
- tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
- console.log("Alarm added with id: " + alarm.id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Triggers an alarm on a given date/time */
+var alarm = new tizen.AlarmAbsolute(new Date(2014, 10, 4, 8, 0));
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
+tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
+console.log("Alarm added with id: " + alarm.id);
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alarms = tizen.alarm.getAll();
-
- // Removes the first alarm
- if (alarms.length > 0) {
- try {
- tizen.alarm.remove(alarms[0].id);
- console.log("Successfully removed the first alarm.");
- } catch(error) {
- console.log("Failed to remove the first alarm.");
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alarms = tizen.alarm.getAll();
+
+/* Removes the first alarm */
+if (alarms.length > 0)
+{
+ try
+ {
+ tizen.alarm.remove(alarms[0].id);
+ console.log("Successfully removed the first alarm.");
+ }
+ catch (error)
+ {
+ console.log("Failed to remove the first alarm.");
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::removeAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.alarm.removeAll();
- console.log("remove all registered alarms in the storage.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.alarm.removeAll();
+console.log("remove all registered alarms in the storage.");
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sets an alarm
- var date = new Date();
- date.setHours(date.getHours()+1);
- var abs_alarm = new tizen.AlarmAbsolute(date);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sets an alarm */
+var date = new Date();
+date.setHours(date.getHours() + 1);
+var abs_alarm = new tizen.AlarmAbsolute(date);
- // Adds an alarm
- tizen.alarm.add(abs_alarm, tizen.application.getCurrentApplication().appInfo.id);
+/* Adds an alarm */
+tizen.alarm.add(abs_alarm, tizen.application.getCurrentApplication().appInfo.id);
- // Gets an alarm
- var alarm = tizen.alarm.get(abs_alarm.id);
- console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
- </pre>
+/* Gets an alarm */
+var alarm = tizen.alarm.get(abs_alarm.id);
+console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::getAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alarms = tizen.alarm.getAll();
- console.log(alarms.length + " alarms present in the storage.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alarms = tizen.alarm.getAll();
+console.log(alarms.length + " alarms present in the storage.");
+</pre>
</div>
</dd>
</dl>
If <em>period</em> is provided, it will be adjusted by the operating system, however this value will not be lower than 600 seconds.
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm in 3 hours from now
- var alarm1 = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
- tizen.alarm.add(alarm1, appId);
+/* Sets an alarm in 3 hours from now */
+var alarm1 = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
+tizen.alarm.add(alarm1, appId);
- // Sets an alarm in one hour, recurring after every 10 minutes
- var alarm2 = new tizen.AlarmRelative(tizen.alarm.PERIOD_HOUR, 10 * tizen.alarm.PERIOD_MINUTE);
- tizen.alarm.add(alarm2, appId);
- </pre>
+/* Sets an alarm in one hour, recurring after every 10 minutes */
+var alarm2 = new tizen.AlarmRelative(tizen.alarm.PERIOD_HOUR, 10 * tizen.alarm.PERIOD_MINUTE);
+tizen.alarm.add(alarm2, appId);
+</pre>
</div>
<div class="constructors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm in 3 hours from now
- var alarm = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
- tizen.alarm.add(alarm, appId);
+/* Sets an alarm in 3 hours from now */
+var alarm = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
+tizen.alarm.add(alarm, appId);
- var sec = alarm.getRemainingSeconds();
- console.log("remaining time is " + sec);
- </pre>
+var sec = alarm.getRemainingSeconds();
+console.log("remaining time is " + sec);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm on January 1st 2014 08:00
- var date = new Date(2014, 0, 1, 8, 0);
- var alarm1 = new tizen.AlarmAbsolute(date);
- tizen.alarm.add(alarm1, appId);
+/* Sets an alarm on January 1st 2014 08:00 */
+var date = new Date(2014, 0, 1, 8, 0);
+var alarm1 = new tizen.AlarmAbsolute(date);
+tizen.alarm.add(alarm1, appId);
- // Sets an alarm on January 1st 2014 08:00, repeating every 2 days
- var alarm2 = new tizen.AlarmAbsolute(date, 2 * tizen.alarm.PERIOD_DAY);
- tizen.alarm.add(alarm2, appId);
+/* Sets an alarm on January 1st 2014 08:00, repeating every 2 days */
+var alarm2 = new tizen.AlarmAbsolute(date, 2 * tizen.alarm.PERIOD_DAY);
+tizen.alarm.add(alarm2, appId);
- // Sets an alarm occurring on every Saturday and Sunday, at 08:00, starting from January 1st 2014
- var alarm3 = new tizen.AlarmAbsolute(date, ["SA", "SU"]);
- tizen.alarm.add(alarm3, appId);
- </pre>
+/* Sets an alarm occurring on every Saturday and Sunday, at 08:00, starting from January 1st 2014 */
+var alarm3 = new tizen.AlarmAbsolute(date, ["SA", "SU"]);
+tizen.alarm.add(alarm3, appId);
+</pre>
</div>
<div class="constructors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
-
- // Sets an alarm on January 1st 2014 08:00
- var date = new Date(2014, 0, 1, 8, 0);
- var alarm1 = new tizen.AlarmAbsolute(date);
- tizen.alarm.add(alarm1, appId);
-
- var date = alarm1.getNextScheduledDate();
- console.log("next scheduled time is " + date);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+
+/* Sets an alarm on January 1st 2014 08:00 */
+var date = new Date(2014, 0, 1, 8, 0);
+var alarm1 = new tizen.AlarmAbsolute(date);
+tizen.alarm.add(alarm1, appId);
+
+var date = alarm1.getNextScheduledDate();
+console.log("next scheduled time is " + date);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
- console.log("Current application's app id is " + app.appInfo.id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+console.log("Current application's app id is " + app.appInfo.id);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::kill">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onKillSuccess() {
- console.log("Application terminated successfully");
- }
-
- function onRunningAppsContext(contexts) {
- // let's assume that the application "targetApp0.main" has been installed.
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++) {
- if (contexts[i].appId == targetId) {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
- }
-
- tizen.application.getAppsContext(onRunningAppsContext);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onKillSuccess()
+{
+ console.log("Application terminated successfully");
+}
+
+function onRunningAppsContext(contexts)
+{
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
+}
+
+tizen.application.getAppsContext(onRunningAppsContext);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::launch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess() {
- console.log("The application has launched successfully");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess()
+{
+ console.log("The application has launched successfully");
+}
- // let's assume that application "targetApp0.main" has been installed
- tizen.application.launch("targetApp0.main", onsuccess);
- </pre>
+/* Let's assume that application "targetApp0.main" has been installed */
+tizen.application.launch("targetApp0.main", onsuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::launchAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- tizen.application.launchAppControl(
- appControl,
- null,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+var appControlReplyCallback =
+{
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+}
+
+tizen.application.launchAppControl(appControl, null,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::findAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- function successCB(appInfos, appControl)
- {
- // appControl is same object with the value passed as first parameter to findAppControl()
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; // select first app's id
-
- tizen.application.launchAppControl(
- appControl,
- appId,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- }
-
- tizen.application.findAppControl(appControl, successCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+function successCB(appInfos, appControl)
+{
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+}
+
+tizen.application.findAppControl(appControl, successCB);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppsContext">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onRunningAppsContext(contexts) {
- for (var i = 0; i < contexts.length; i++)
- console.log("ID : " + contexts[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onRunningAppsContext(contexts)
+{
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
+}
- tizen.application.getAppsContext(onRunningAppsContext);
- </pre>
+tizen.application.getAppsContext(onRunningAppsContext);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppContext">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appContext = tizen.application.getAppContext(null);
- console.log("Application context retrieved for app " + appContext.appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appContext = tizen.application.getAppContext(null);
+console.log("Application context retrieved for app " + appContext.appId);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppsInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledApps(applications) {
- for (var i = 0; i < applications.length; i++)
- console.log("ID : " + applications[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledApps(applications)
+{
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
+}
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appInfo = tizen.application.getAppInfo(null);
- console.log("Current application name : " + appInfo.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appInfo = tizen.application.getAppInfo(null);
+console.log("Current application name: " + appInfo.name);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppCerts">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appCerts = tizen.application.getAppCerts(null);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appCerts = tizen.application.getAppCerts(null);
- for (var i = 0; i < appCerts.length; i++) {
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
- }
- </pre>
+for (var i = 0; i < appCerts.length; i++)
+{
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppSharedURI">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var sharedDir = tizen.application.getAppSharedURI(null);
- console.log("shared directory : " + sharedDir);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var sharedDir = tizen.application.getAppSharedURI(null);
+console.log("shared directory: " + sharedDir);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppMetaData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var metaDataArray = tizen.application.getAppMetaData(null);
- console.log("size of metadata : " + metaDataArray.length);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var metaDataArray = tizen.application.getAppMetaData(null);
+console.log("size of metadata: " + metaDataArray.length);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ApplicationManager::addAppInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ApplicationManager::removeAppInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- tizen.application.removeAppInfoEventListener(watchId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+tizen.application.removeAppInfoEventListener(watchId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
- app.exit();
- </pre>
+app.exit();
+</pre>
</div>
</dd>
<dt class="method" id="Application::hide">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
- app.hide();
- </pre>
+app.hide();
+</pre>
</div>
</dd>
<dt class="method" id="Application::getRequestedAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
- }
- </pre>
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Application::addEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- if (appId) {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data) {
- console.log("Data: " + JSON.stringify(data));
- // do something
- });
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="Application::removeEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- if (appId) {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data) {
- if (watchId) {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="Application::broadcastEvent">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCustomData = {
- foo: 'bar'
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCustomData =
+{
+ foo: 'bar'
+};
- var app = tizen.application.getCurrentApplication();
+var app = tizen.application.getCurrentApplication();
- app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
- </pre>
+app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
+</pre>
</div>
</dd>
<dt class="method" id="Application::broadcastTrustedEvent">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myTrustedCustomData = {
- foo: 'bar'
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myTrustedCustomData =
+{
+ foo: 'bar'
+};
- var app = tizen.application.getCurrentApplication();
+var app = tizen.application.getCurrentApplication();
- app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
- </pre>
+app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
+</pre>
</div>
</dd>
</dl>
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
+</pre>
</div>
<div class="constructors">
<h4 id="ApplicationControlData::constructor">Constructors</h4>
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl =
- new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/view",
- null,
- "image/jpeg",
- null,
- [new tizen.ApplicationControlData("images",
- [imagedata1, imagedata2])] );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+</pre>
</div>
<div class="constructors">
<h4 id="ApplicationControl::constructor">Constructors</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick") {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="RequestedApplicationControl::replyFailure">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick") {
- reqAppControl.replyFailure();
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledApps(applications) {
- for (var i = 0; i < applications.length; i++)
- console.log("ID : " + applications[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledApps(applications)
+{
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
+}
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- // FindAppControlSuccessCallback instance
- function successCB(appInfos, appControl)
- {
- // appControl is same object with the value passed as first parameter to findAppControl()
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; // select first app's id
-
- tizen.application.launchAppControl(
- appControl,
- appId,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- }
-
- tizen.application.findAppControl(appControl, successCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+/* FindAppControlSuccessCallback instance */
+function successCB(appInfos, appControl)
+{
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+}
+
+tizen.application.findAppControl(appControl, successCB);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- // ApplicationControlDataArrayReplyCallback instance
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- tizen.application.launchAppControl(
- appControl,
- null,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+/* ApplicationControlDataArrayReplyCallback instance */
+var appControlReplyCallback =
+{
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+}
+
+tizen.application.launchAppControl(appControl, null,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data) {
- console.log("Data: " + JSON.stringify(data));
- // do something
- };
-
- if (appId) {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCallback(archive) {
- console.log("Success, can now read from archive " + archive);
- }
-
- function errorCallback(error) {
- console.log(error);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCallback(archive)
+{
+ console.log("Success, can now read from archive " + archive);
+}
+
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveManager::abort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function openSuccess(archive) {
- operationId = archive.extractAll("downloads/extracted");
- tizen.archive.abort(operationId);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function openSuccess(archive)
+{
+ operationId = archive.extractAll("downloads/extracted");
+ tizen.archive.abort(operationId);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function successCallback() {
- console.log("done");
- }
-
- function progressCallback(opId, val, name) {
- console.log("opId: " + opId + " with progress val: " + val);
- }
-
- function createSuccess(archive) {
- archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
- }
-
- tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function successCallback()
+{
+ console.log("done");
+}
+
+function progressCallback(opId, val, name)
+{
+ console.log("opId: " + opId + " with progress val: " + val);
+}
+
+function createSuccess(archive)
+{
+ archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
+}
+
+tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::extractAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function successCallback() {
- console.log("done");
- }
-
- function progressCallback(opId, val, name) {
- console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
- }
-
- function openSuccess(archive) {
- archive.extractAll("music", successCallback, errorCallback, progressCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function successCallback()
+{
+ console.log("done");
+}
+
+function progressCallback(opId, val, name)
+{
+ console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
+}
+
+function openSuccess(archive)
+{
+ archive.extractAll("music", successCallback, errorCallback, progressCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::getEntries">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function getEntriesSuccess(entries) {
- console.log("Entries length: " + entries.length);
- for (var i=0; i < entries.length; i++) {
- console.log(entries[i].name);
- }
- }
-
- function openSuccess(archive) {
- archive.getEntries(getEntriesSuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function getEntriesSuccess(entries)
+{
+ console.log("Entries length: " + entries.length);
+ for (var i = 0; i < entries.length; i++)
+ {
+ console.log(entries[i].name);
+ }
+}
+
+function openSuccess(archive)
+{
+ archive.getEntries(getEntriesSuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::getEntryByName">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function getEntrySuccess(entry) {
- console.log("Entry: " + entry.name + " size: " + entry.size);
- }
-
- function openSuccess(archive) {
- archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function getEntrySuccess(entry)
+{
+ console.log("Entry: " + entry.name + " size: " + entry.size);
+}
+
+function openSuccess(archive)
+{
+ archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::close">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function extractSuccessCallback() {
- console.log("done");
- }
-
- function getEntrySuccess(entry) {
- entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
- }
-
- function openSuccess(archive) {
- archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function extractSuccessCallback()
+{
+ console.log("done");
+}
+
+function getEntrySuccess(entry)
+{
+ entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
+}
+
+function openSuccess(archive)
+{
+ archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Assume the content is a Content object as a result of find method.
- // Check the description is editable, and then set a description.
- if (content.editableAttributes.indexOf("description") >= 0) {
- content.description = "Sample content";
- }
- tizen.content.update(content);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assume the content is a Content object as a result of find method */
+/* Check the description is editable, and then set a description */
+if (content.editableAttributes.indexOf("description") >= 0)
+{
+ content.description = "Sample content";
+}
+tizen.content.update(content);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::updateBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example increases rating of an content by 1
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function successCB() {
- console.log('Attributes set successfully');
- }
-
- // Assume the content is a Content object as a result of find method.
- // Check the rating is editable, and then increase by 1.
- if (content.editableAttributes.indexOf("rating") >= 0) {
- content.rating++;
- }
- tizen.content.updateBatch([content], successCB, errorCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example increases rating of a content by 1 */
+
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function successCB()
+{
+ console.log('Attributes set successfully');
+}
+
+/* Assume the content is a Content object as a result of find method */
+/* Check the rating is editable, and then increase by 1 */
+if (content.editableAttributes.indexOf("rating") >= 0)
+{
+ content.rating++;
+}
+tizen.content.updateBatch([content], successCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::getDirectories">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example retrieves content directories in the storage.
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example retrieves content directories in the storage */
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function printDirectory(directory, index, directories) {
- console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
- }
- function getDirectoriesCB(directories) {
- directories.forEach(printDirectory);
- }
+function printDirectory(directory, index, directories)
+{
+ console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
+}
- tizen.content.getDirectories(getDirectoriesCB, errorCB);
- </pre>
+function getDirectoriesCB(directories)
+{
+ directories.forEach(printDirectory);
+}
+
+tizen.content.getDirectories(getDirectoriesCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::find">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the name.
- var count = 100;
- var offset = 0;
- var sortMode = new tizen.SortMode("name", "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('Name: ' + content.name + ' Title: ' + content.title + '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);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the name */
+var count = 100;
+var offset = 0;
+var sortMode = new tizen.SortMode("name", "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('Name: ' + content.name + ' Title: ' + content.title +
+ '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);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::scanFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example scan 'tizen.jpg' in media directory
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example scans 'tizen.jpg' in media directory */
- function successCB(path) {
- console.log('scanning is completed');
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- tizen.filesystem.resolve("images/tizen.jpg", function(imageFile) {
- tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
- });
+function successCB(path)
+{
+ console.log('scanning is completed');
+}
- </pre>
+tizen.filesystem.resolve("images/tizen.jpg", function(imageFile)
+{
+ tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
+});
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::scanDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example scans 'images' directory
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example scans 'images' directory */
- function successCB(path) {
- console.log('scanning is completed');
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- tizen.filesystem.resolve("images", function(directory) {
- tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
- });
+function successCB(path)
+{
+ console.log('scanning is completed');
+}
- </pre>
+tizen.filesystem.resolve("images", function(directory)
+{
+ tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
+});
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::cancelScanDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.content.cancelScanDirectory(directory.toURI());
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.content.cancelScanDirectory(directory.toURI());
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::addChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- // Adds the listener
- var listenerId = tizen.content.addChangeListener(listener);
-
- console.log('Listener ID: ' + listenerId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+/* Adds the listener */
+var listenerId = tizen.content.addChangeListener(listener);
+
+console.log('Listener ID: ' + listenerId);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Listener ID: 1
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- var listenerId = tizen.content.addChangeListener(listener);
-
- // Do some job here and when the listener is not needed anymore remove it
-
- // Removes the listener
- tizen.content.removeChangeListener(listenerId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+var listenerId = tizen.content.addChangeListener(listener);
+
+/* Do some job here and when the listener is not needed anymore remove it */
+
+/* Removes the listener */
+tizen.content.removeChangeListener(listenerId);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ContentManager::setChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener= {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- // Registers to be notified when the content changes
- tizen.content.setChangeListener(listener);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+/* Registers to be notified when the content changes */
+tizen.content.setChangeListener(listener);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ContentManager::unsetChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.content.unsetChangeListener();
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.content.unsetChangeListener();
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::getPlaylists">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::createPlaylist">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
- var gPlaylist;
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err.message);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
- }
-
- function findSuccess(contents) {
- if (contents.length > 0) {
- gPlaylist.add(contents[0]);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- }
-
- function findFail(err) {
- console.log("find FAIL: " + err.message);
- }
-
- function createSuccess(playlist) {
- console.log("create SUCCESS");
-
- gPlaylist = playlist;
- tizen.content.find(findSuccess, findFail, null,
- new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
- }
-
- function createFail(err) {
- console.log("create FAIL: " + err.message);
- }
-
- tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+var gPlaylist;
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err.message);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+}
+
+function findSuccess(contents)
+{
+ if (contents.length > 0)
+ {
+ gPlaylist.add(contents[0]);
+ }
+
+ tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+}
+
+function findFail(err)
+{
+ console.log("find FAIL: " + err.message);
+}
+
+function createSuccess(playlist)
+{
+ console.log("create SUCCESS");
+
+ gPlaylist = playlist;
+ tizen.content.find(findSuccess, findFail, null,
+ new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
+}
+
+function createFail(err)
+{
+ console.log("create FAIL: " + err.message);
+}
+
+tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::removePlaylist">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
-
- function removePlaylistSuccess() {
- console.log("removePlaylist SUCCESS");
- }
-
- function removePlaylistFail(err) {
- console.log("removePlaylist FAIL: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
-
- if(gPlaylists.length < 1) {
- console.log("Please add at least 1 playlist");
- return;
- }
-
- console.log("will remove playlist at index [0] name:"
- + gPlaylists[0].name);
-
- tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
- removePlaylistFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+
+function removePlaylistSuccess()
+{
+ console.log("removePlaylist SUCCESS");
+}
+
+function removePlaylistFail(err)
+{
+ console.log("removePlaylist FAIL: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+
+ if (gPlaylists.length < 1)
+ {
+ console.log("Please add at least 1 playlist");
+
+ return;
+ }
+
+ console.log("will remove playlist at index [0] name:"
+ + gPlaylists[0].name);
+
+ tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
+ removePlaylistFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::createThumbnail">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function createCB(path) {
- console.log("The thumbnail path is " + path);
- }
-
- function findCB(contents) {
- if (contents.length > 0) {
- tizen.content.createThumbnail(contents[0], createCB);
- }
- }
-
- tizen.content.find(findCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function createCB(path)
+{
+ console.log("The thumbnail path is " + path);
+}
+
+function findCB(contents)
+{
+ if (contents.length > 0)
+ {
+ tizen.content.createThumbnail(contents[0], createCB);
+ }
+}
+
+tizen.content.find(findCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> The thumbnail path is /home/owner/share/media/.thumb/phone/.jpg-bed1d5f494830f7a52e1217f1e924aff.jpg
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after remove) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist items:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 1) {
- console.log("Please add at least 1 tracks to playlist!");
- return;
- }
-
- console.log("Original playlist:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will remove item at index [0] name:" + gItems[0].content.name);
- gCurPlaylist.remove(gItems[0]);
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after remove) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 1)
+ {
+ console.log("Please add at least 1 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will remove item at index [0] name:" + gItems[0].content.name);
+ gCurPlaylist.remove(gItems[0]);
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::removeBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after remove batch) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist after remove batch:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function removeBatchSuccess() {
- console.log("removeBatch success");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function removeBatchFail(err) {
- console.log("removeBatch failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 4) {
- console.log("Please add at least 4 tracks to playlist!");
- return;
- }
-
- console.log("Original playlist:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will remove items at index [0](name:" + gItems[0].content.name
- + ") and at index [2](name:" + gItems[2].content.name + ")");
- gCurPlaylist.removeBatch([gItems[2], gItems[0]],
- removeBatchSuccess, removeBatchFail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after remove batch) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist after remove batch:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function removeBatchSuccess()
+{
+ console.log("removeBatch success");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function removeBatchFail(err)
+{
+ console.log("removeBatch failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 4)
+ {
+ console.log("Please add at least 4 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will remove items at index [0](name:" + gItems[0].content.name
+ + ") and at index [2](name:" + gItems[2].content.name + ")");
+ gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function getSuccess(items) {
- gItems = items;
- console.log("Playlist items:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].name);
- }
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- // To retrieves all playlist items of 'gCurPlaylist' playlist.
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function getSuccess(items)
+{
+ gItems = items;
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].name);
+ }
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ /* To retrieve all playlist items of 'gCurPlaylist' playlist */
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::setOrder">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist, gExpectedOrder;
-
- function get2Fail(err) {
- console.log("get items (after set order) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist order after setOrder:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function setOrderSuccess() {
- console.log("set items order SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function setOrderFail(err) {
- console.log("set items order failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 2) {
- console.log("Please add at least 2 tracks to playlist!");
- return;
- }
-
- console.log("Original order:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- gExpectedOrder = gItems.slice(0);
- gExpectedOrder.reverse();
-
- console.log("New order:");
- for(var i = 0; i < gExpectedOrder.length ; ++i) {
- console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
- }
-
- gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist, gExpectedOrder;
+
+function get2Fail(err)
+{
+ console.log("get items (after set order) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist order after setOrder:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function setOrderSuccess()
+{
+ console.log("set items order SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function setOrderFail(err)
+{
+ console.log("set items order failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ gExpectedOrder = gItems.slice(0);
+ gExpectedOrder.reverse();
+
+ console.log("New order:");
+ for (var i = 0; i < gExpectedOrder.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
+ }
+
+ gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::move">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after move item) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist order after move:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function moveSuccess() {
- console.log("move item SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function moveFail(err) {
- console.log("move item failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 2) {
- console.log("Please add at least 2 tracks to playlist!");
- return;
- }
-
- console.log("Original order:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will move item at index [1] (name: " +
- gItems[1].content.name + ") up by one place (to [0])");
-
- gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
- gItems.unshift(gItems.splice(1, 1)[0]);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after move item) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist order after move:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function moveSuccess()
+{
+ console.log("move item SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function moveFail(err)
+{
+ console.log("move item failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will move item at index [1] (name: " +
+ gItems[1].content.name + ") up by one place (to [0])");
+
+ gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
+ gItems.unshift(gItems.splice(1, 1)[0]);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
</dl>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Console API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Console API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Console">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log('A is for Alice.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log('A is for Alice.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>A is for Alice.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.error('B is for Bob.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.error('B is for Bob.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>B is for Bob.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.warn('C is for Christopher.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.warn('C is for Christopher.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>C is for Christopher.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.info('D is for Dorothy.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.info('D is for Dorothy.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>D is for Dorothy.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.debug('E is for Eve.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.debug('E is for Eve.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>E is for Eve.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var felix = 'Felix';
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var felix = 'Felix';
- // This assertion checks whether the first letter in name 'Felix' is 'A':
- console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.');
- </pre>
+/* This assertion checks whether the first letter in name 'Felix' is 'A' */
+console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Felix does not start with A.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var john = {name: "John", surname: "Doe"};
- console.dir(john.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var john = {name: "John", surname: "Doe"};
+console.dir(john.name);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>John
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var john = {name: "John", surname: "Doe"};
- console.dirxml(john.surname);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var john = {name: "John", surname: "Doe"};
+console.dirxml(john.surname);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Doe
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.time("Big array initialization");
- var array = new Array(1000000);
- for (var i = array.length - 1; i >= 0; i -= 1) {
- array[i] = new Object();
- };
- console.timeEnd("Big array initialization");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.time("Big array initialization");
+var array = new Array(1000000);
+for (var i = array.length - 1; i >= 0; i -= 1)
+{
+ array[i] = new Object();
+};
+console.timeEnd("Big array initialization");
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Big array initialization: 461.989ms
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.time("Big array initialization");
- var array = new Array(1000000);
- for (var i = array.length - 1; i >= 0; i -= 1) {
- array[i] = new Object();
- };
- console.timeEnd("Big array initialization");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.time("Big array initialization");
+var array = new Array(1000000);
+for (var i = array.length - 1; i >= 0; i -= 1)
+{
+ array[i] = new Object();
+};
+console.timeEnd("Big array initialization");
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Big array initialization: 461.989ms
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Cordova API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Cordova API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Cordova">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>DeviceMotion API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>DeviceMotion API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::DeviceMotion">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
- </pre>
+navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- console.log('Please wait 3 seconds for the next measurement...');
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ console.log('Please wait 3 seconds for the next measurement...');
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- var options = { frequency: 3000 }; // Update every 3 seconds
+var options = {frequency: 3000}; /* Update every 3 seconds */
- var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
- </pre>
+var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var counter = 0, watchID;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var counter = 0, watchID;
- function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- if(3 == ++counter) {
- navigator.accelerometer.clearWatch(watchID);
- }
- };
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ if (3 == ++counter)
+ {
+ navigator.accelerometer.clearWatch(watchID);
+ }
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- var options = { frequency: 30 }; // Update every 0.03 seconds
+var options = {frequency: 30}; /* Update every 0.03 seconds */
- watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
- </pre>
+watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Device API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Device API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Device">
Returns the version of Cordova running on the device.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Cordova: ' + device.cordova);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Cordova: ' + device.cordova);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Cordova: 5.1.1
Get the the name of the device's model or product. The value is set by the device manufacturer and may be different across versions of the same product.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Model: ' + device.model);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Model: ' + device.model);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Model: tm1
Get the device's operating system name.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Platform: ' + device.platform);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Platform: ' + device.platform);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Platform: Tizen
Get the device's Universally Unique Identifier (UUID). The details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device UUID: ' + device.uuid);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device UUID: ' + device.uuid);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device UUID: 2LR1b3MXfEUSFvH04m4e1EXYvQA=
Get the operating system version.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Version: ' + device.version);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Version: ' + device.version);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Version: 3.0
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Dialogs API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Dialogs API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Dialogs">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alertDismissed = function() {
- console.log('Alert was dismissed');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alertDismissed = function()
+{
+ console.log('Alert was dismissed');
+}
- navigator.notification.alert('Please click OK button', alertDismissed,
- 'OK click alert', 'OK');
- </pre>
+navigator.notification.alert('Please click OK button', alertDismissed,
+ 'OK click alert', 'OK');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Alert was dismissed
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var confirmCallback = function(buttonIndex) {
- console.log('Selected option was ' + buttonIndex);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var confirmCallback = function(buttonIndex)
+{
+ console.log('Selected option was ' + buttonIndex);
+}
- navigator.notification.confirm('Choose one option', confirmCallback,
- 'Options', ['Option1', 'Option2']);
- </pre>
+navigator.notification.confirm('Choose one option', confirmCallback,
+ 'Options', ['Option1', 'Option2']);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Selected option was 1
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var promptCallback = function(results) {
- console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var promptCallback = function(results)
+{
+ console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
+}
- navigator.notification.prompt('Please enter your name',
- promptCallback,
- 'Registration Box',
- ['Ok', 'Exit'],
- 'e.g. Jane Doe');
- </pre>
+navigator.notification.prompt('Please enter your name', promptCallback,
+ 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Hello Jane Doe, you selected option 1
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var times = 2;
- console.log('Device would beep ' + times + ' times');
- navigator.notification.beep(times);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var times = 2;
+console.log('Device would beep ' + times + ' times');
+navigator.notification.beep(times);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device would beep 2 times
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Events API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Events API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Events">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.deviceready.html">Cordova deviceredy event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- // Now safe to use device APIs
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ /* Now safe to use device APIs */
+}
+</pre>
</div>
</div>
<div class="interface" id="PauseEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.pause.html">Cordova pause event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('pause', onPause, false);
- }
-
- function onPause() {
- // Handle the pause event
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('pause', onPause, false);
+}
+
+function onPause()
+{
+ /* Handle the pause event */
+}
+</pre>
</div>
</div>
<div class="interface" id="ResumeEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.resume.html">Cordova resume event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('resume', onResume, false);
- }
-
- function onResume() {
- // Handle the resume event
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('resume', onResume, false);
+}
+
+function onResume()
+{
+ /* Handle the resume event */
+}
+</pre>
</div>
</div>
<div class="interface" id="BackButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.backbutton.html">Cordova backbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('backbutton', onBackKeyDown, false);
- }
-
- function onBackKeyDown() {
- // Handle the back button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('backbutton', onBackKeyDown, false);
+}
+
+function onBackKeyDown()
+{
+ /* Handle the back button */
+}
+</pre>
</div>
</div>
<div class="interface" id="MenuButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.menubutton.html">Cordova menubutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('menubutton', onMenuKeyDown, false);
- }
-
- function onMenuKeyDown() {
- // Handle the back button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('menubutton', onMenuKeyDown, false);
+}
+
+function onMenuKeyDown()
+{
+ /* Handle the back button */
+}
+</pre>
</div>
</div>
<div class="interface" id="SearchButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.searchbutton.html">Cordova searchbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('searchbutton', onSearchKeyDown, false);
- }
-
- function onSearchKeyDown() {
- // Handle the search button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('searchbutton', onSearchKeyDown, false);
+}
+
+function onSearchKeyDown()
+{
+ /* Handle the search button */
+}
+</pre>
</div>
</div>
<div class="interface" id="StartCallEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.startcallbutton.html">Cordova startcallbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('startcallbutton', onStartCallKeyDown, false);
- }
-
- function onStartCallKeyDown() {
- // Handle the start call button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('startcallbutton', onStartCallKeyDown, false);
+}
+
+function onStartCallKeyDown()
+{
+ /* Handle the start call button */
+}
+</pre>
</div>
</div>
<div class="interface" id="EndCallButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.endcallbutton.html">Cordova endcallbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('endcallbutton', onEndCallKeyDown, false);
- }
-
- function onEndCallKeyDown() {
- // Handle the end call button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('endcallbutton', onEndCallKeyDown, false);
+}
+
+function onEndCallKeyDown()
+{
+ /* Handle the end call button */
+}
+</pre>
</div>
</div>
<div class="interface" id="VolumeDownButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.volumedownbutton.html">Cordova volumedownbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
- }
-
- function onVolumeDownKeyDown() {
- // Handle the volume down button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
+}
+
+function onVolumeDownKeyDown()
+{
+ /* Handle the volume down button */
+}
+</pre>
</div>
</div>
<div class="interface" id="VolumeUpButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.volumeupbutton.html">Cordova volumeupbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
- }
-
- function onVolumeUpKeyDown() {
- // Handle the volume up button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
+}
+
+function onVolumeUpKeyDown()
+{
+ /* Handle the volume up button */
+}
+</pre>
</div>
</div>
</div>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>File API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>File API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::File">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var eventInit = {
- loaded: 128,
- total: 1024
- };
- var event = new ProgressEvent('submit', eventInit);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var eventInit =
+{
+ loaded: 128,
+ total: 1024
+};
+var event = new ProgressEvent('submit', eventInit);
+</pre>
</div>
<div class="constructors">
<h4 id="ProgressEvent::constructor">Constructors</h4>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The directory where the application is installed " + cordova.file.applicationDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("The directory where the application is installed " + cordova.file.applicationDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>The directory where the application is installed file:///opt/usr/apps/WfigBlWDyf/res/wgt/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Root directory of the application's sandbox file:///opt/usr/apps/WfigBlWDyf/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Data directory " + cordova.file.dataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Data directory " + cordova.file.dataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Data directory file:///opt/usr/apps/WfigBlWDyf/data/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Cache directory " + cordova.file.cacheDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Cache directory " + cordova.file.cacheDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Cache directory file:///opt/usr/apps/WfigBlWDyf/tmp/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Space on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Data files on external storage " + cordova.file.externalDataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Data files on external storage " + cordova.file.externalDataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Data files on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Cache on external storage " + cordova.file.externalCacheDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Cache on external storage " + cordova.file.externalCacheDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Cache on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Root on external storage " + cordova.file.externalRootDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Root on external storage " + cordova.file.externalRootDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Root on external storage file:///usr/storage/sdcard/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Temp directory " + cordova.file.tempDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Temp directory " + cordova.file.tempDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Temp directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Synced data directory " + cordova.file.syncedDataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Synced data directory " + cordova.file.syncedDataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Synced data directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Documents directory " + cordova.file.documentsDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Documents directory " + cordova.file.documentsDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Documents directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Files globally available to all applications " + cordova.file.sharedDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Files globally available to all applications " + cordova.file.sharedDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Files globally available to all applications file:///opt/usr/media/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function (fileSystem) {
- console.log('Name of the filesystem: '+fileSystem.name);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fileSystem)
+{
+ console.log('Name of the filesystem: ' + fileSystem.name);
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Name of the filesystem: temporary
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(fs) {
- console.log('File system name ' + fs.name);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- requestFileSystem(TEMPORARY, 1024*1024, successCallback, errorCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(fs)
+{
+ console.log('File system name ' + fs.name);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>File system name temporary
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry) {
- console.log('Entry name ' + entry.name);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- var uri = 'file:///home/owner/content/Documents/example.txt';
- resolveLocalFileSystemURL(uri, successCallback, errorCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry)
+{
+ console.log('Entry name ' + entry.name);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+var uri = 'file:///home/owner/content/Documents/example.txt';
+resolveLocalFileSystemURL(uri, successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Entry name example.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getMetadata(function (metadata) {
- console.log("Last modification time: " + metadata.modificationTime);// get metadata successfully
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getMetadata(function(metadata)
+ {
+ console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Last modification time: Fri Jan 02 2015 03:58:08 GMT+0900 (KST)
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry){console.log('Full path to the moved file: '+entry.fullPath)};
- requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry) {
- fs.root.getFile("aa.txt", {create:true}, function(fileentry) {
- console.log('Full path before move: '+fileentry.fullPath);
- fileentry.moveTo(direntry,'newname.txt',successCallback);
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry) {console.log('Full path to the moved file: ' + entry.fullPath)};
+
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("aa.txt", {create:true}, function(fileentry)
+ {
+ console.log('Full path before move: ' + fileentry.fullPath);
+ fileentry.moveTo(direntry, 'newname.txt', successCallback);
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Full path before move: /aa.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry){console.log('Full path to the copied file: '+entry.fullPath);};
- requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true},
- function(direntry) {
- fs.root.getFile("test.txt", {create:true},
- function(fileentry) {
- fileentry.copyTo(direntry,'newname.txt',successCallback);
- }
- );
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry) {console.log('Full path to the copied file: ' + entry.fullPath);};
+
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("test.txt", {create:true}, function(fileentry)
+ {
+ fileentry.copyTo(direntry, 'newname.txt', successCallback);
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Full path to the copied file: /testDirectory/newname.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getParent(function (entry) {
- console.log("success");
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getParent(function(entry)
+ {
+ console.log("success");
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile('test.txt', {create: true}, function(fileEntry) {
- fileEntry.remove(function () {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile('test.txt', {create: true}, function(fileEntry)
+ {
+ fileEntry.remove(function()
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
URL that can be used to identify this entry.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true},
- function(entry) {
- var url = entry.toURL();
- console.log('URL: '+url);
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(entry)
+ {
+ var url = entry.toURL();
+ console.log('URL: ' + url);
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>URL: file:///home/owner/apps_rw/WfigBlWDyf/tmp/testDirectory/
DirectoryReader
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function (entry) {
- entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry) {
- var directoryReader = dirEntry.createReader();
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(entry)
+{
+ entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
+ {
+ var directoryReader = dirEntry.createReader();
+ });
+});
+</pre>
</div>
</dd>
<dt class="method" id="DirectoryEntry::getDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory("ert",{create:true},function(dir){
- console.log('Created dir: '+dir.name);
- })
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory("ert", {create:true}, function(dir)
+ {
+ console.log('Created dir: ' + dir.name);
+ })
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Created dir: ert
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("qa.txt",{create:true},function(file){
- console.log('Created file: '+file.name);
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("qa.txt", {create:true}, function(file)
+ {
+ console.log('Created file: ' + file.name);
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Created file: qa.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory("testDirectory", {create:true},
- function(directoryEntry) {
- directoryEntry.removeRecursively(function() {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
+ {
+ directoryEntry.removeRecursively(function()
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- var a = fs.root.createReader();
- a.readEntries(function successCallback(entries) {
- console.log("success");
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ var a = fs.root.createReader();
+ a.readEntries(function successCallback(entries)
+ {
+ console.log("success");
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("logFile.txt", {create: true}, function (f) {
- f.createWriter(function(fileWriter) {
- fileWriter.write(new Blob(['hello']));
- fileWriter.onerror = function(e) {
- console.log('Write file failed:' + e);
- };
- fileWriter.onwriteend = function () {
- console.log("success");
- };
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("logFile.txt", {create: true}, function(f)
+ {
+ f.createWriter(function(fileWriter)
+ {
+ fileWriter.write(new Blob(['hello']));
+ fileWriter.onerror = function(e)
+ {
+ console.log('Write file failed:' + e);
+ };
+ fileWriter.onwriteend = function()
+ {
+ console.log("success");
+ };
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("abcdz.txt", {create: true}, function (f) {
- f.file(function (file) {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("abcdz.txt", {create: true}, function(f)
+ {
+ f.file(function(file)
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var deviceReady, fileReader;
- deviceReady = function() {
- fileReader = new FileReader();
- };
- document.addEventListener('deviceready', deviceReady, true);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var deviceReady, fileReader;
+deviceReady = function()
+{
+ fileReader = new FileReader();
+};
+document.addEventListener('deviceready', deviceReady, true);
+</pre>
</div>
<div class="constructors">
<h4 id="FileReader::constructor">Constructors</h4>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded');
- };
- fileReader.onabort = function(){
- console.log('aborted');
- };
- fileReader.readAsDataURL(blob);
- fileReader.abort();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded');
+};
+fileReader.onabort = function()
+{
+ console.log('aborted');
+};
+fileReader.readAsDataURL(blob);
+fileReader.abort();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>aborted
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsDataURL(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsDataURL(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = data:;base64,YWJj
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsText(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsText(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = abc
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsBinaryString(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsBinaryString(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = abc
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- resultValue = fileReader.result;
- console.log("Result: "+resultValue.toString()+'<br>'+'ByteLength: '+resultValue.byteLength);
- };
- fileReader.readAsArrayBuffer(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ resultValue = fileReader.result;
+ console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
+};
+fileReader.readAsArrayBuffer(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Result: [object ArrayBuffer]
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('write success');
- };
- writer.onabort = function(e){
- console.log('abort');
- };
- writer.write('some sample text');
- writer.abort();
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+ writer.onabort = function(e)
+ {
+ console.log('abort');
+ };
+ writer.write('some sample text');
+ writer.abort();
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>abort
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- // fast forwards file pointer to the end of file.
- writer.seek(writer.length);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ /* Fast forwards file pointer to the end of file */
+ writer.seek(writer.length);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="FileWriter::truncate">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('truncate success');
- };
-
- writer.truncate(10);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('truncate success');
+ };
+
+ writer.truncate(10);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>truncate success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('write success');
- };
-
- writer.write('some sample text');
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+
+ writer.write('some sample text');
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>write success
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>FileTransfer API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>FileTransfer API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::FileTransfer">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // We assume the variable fileURL contains a valid URL to a text file on the device.
-
- var win = function (r) {
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
- }
-
- var fail = function (error) {
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- }
-
- var options = new FileUploadOptions();
- options.fileKey = 'file';
- options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
- options.mimeType = 'text/plain';
-
- var params = {};
- params.value1 = 'test';
- params.value2 = 'param';
-
- options.params = params;
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail, options);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Assume the variable fileURL contains a valid URL to a text file on the device */
+
+var win = function(r)
+{
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
+}
+
+var fail = function(error)
+{
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+}
+
+var options = new FileUploadOptions();
+options.fileKey = 'file';
+options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
+options.mimeType = 'text/plain';
+
+var params = {};
+params.value1 = 'test';
+params.value2 = 'param';
+
+options.params = params;
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Code = 200
<dl>
<pre class="webidl prettyprint">FileUploadOptions(DOMString fileKey, DOMString fileName, DOMString mimeType, <a href="#FileUploadParams">FileUploadParams</a> params, <a href="#HeaderFields">HeaderFields</a> headers, DOMString httpMethod);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a FileUploadOptions object.
- var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a FileUploadOptions object */
+var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
+</pre>
</div>
</dl>
</div>
<dl>
<pre class="webidl prettyprint">FileTransfer();</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a FileTransfer object.
- var file_transfer = new FileTransfer();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a FileTransfer object */
+var file_transfer = new FileTransfer();
+</pre>
</div>
</dl>
</div>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function(r) {
- console.log('Success. File uploaded.');
- }
-
- var fail = function(error) {
- // error.code == FileTransferError.ABORT_ERR
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- };
-
- var ft = new FileTransfer();
-
- ft.onprogress = function(event) {
- console.log('uploaded: ' + event.loaded);
- };
-
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Success. File uploaded.');
+}
+
+var fail = function(error)
+{
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+};
+
+var ft = new FileTransfer();
+
+ft.onprogress = function(event)
+{
+ console.log('uploaded: ' + event.loaded);
+};
+
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>uploaded: 512
uploaded: 1024
-Success. File uploaded.
+Success. File uploaded.
</pre>
</div>
</li></ul>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function (r) {
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
- }
-
- var fail = function (error) {
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- }
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
+}
+
+var fail = function(error)
+{
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+}
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Code = 200
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var fileTransfer = new FileTransfer();
- var uri = encodeURI('http://some.server.com/download.php');
-
- fileTransfer.download(
- uri,
- fileURL,
- function(entry) {
- console.log('download complete: ' + entry.toURL());
- },
- function(error) {
- console.log('download error source ' + error.source);
- console.log('download error target ' + error.target);
- console.log('upload error code' + error.code);
- },
- false,
- {
- headers: {
- 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var fileTransfer = new FileTransfer();
+var uri = encodeURI('http://some.server.com/download.php');
+
+fileTransfer.download(uri, fileURL, function(entry)
+{
+ console.log('download complete: ' + entry.toURL());
+}, function(error)
+{
+ console.log('download error source ' + error.source);
+ console.log('download error target ' + error.target);
+ console.log('upload error code' + error.code);
+}, false,
+{
+ headers:
+ {
+ 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
+ }
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>download complete: file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
http://tizen.org/privilege/internet
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function(r) {
- console.log('Should not be called.');
- }
-
- var fail = function(error) {
- // error.code == FileTransferError.ABORT_ERR
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- };
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- ft.abort();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Should not be called.');
+}
+
+var fail = function(error)
+{
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+};
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+ft.abort();
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre>An error has occured: Code = 4
+<span class="title"><p>Output example:</p></span><pre>An error has occurred: Code = 4
upload error source file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
upload error target http://some.server.com/file.txt
</pre>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Globalization API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Globalization API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Globalization">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output the text
- // similar to the results that follow.
-
- navigator.globalization.getPreferredLanguage(
- function (language) { console.log('Language: ' + language.value); },
- function () { console.log('Error getting language.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text
+ similar to the results that follow
+*/
+navigator.globalization.getPreferredLanguage(function(language)
+{
+ console.log('Language: ' + language.value);
+}, function()
+{
+ console.log('Error getting language.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Language: en-US
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output the text
- // similar to the results that follow.
-
- navigator.globalization.getLocaleName(
- function (locale) { console.log('Locale: ' + locale.value); },
- function () { console.log('Error getting locale.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text
+ similar to the results that follow
+*/
+navigator.globalization.getLocaleName(function(locale)
+{
+ console.log('Locale: ' + locale.value);
+}, function()
+{
+ console.log('Error getting locale.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Locale: en-US
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output text similar to the results that follow.
- // This example uses the default conversion options.
-
- navigator.globalization.dateToString(
- new Date(),
- function (date) { console.log('Date: ' + date.value); },
- function () { console.log('Error getting dateString.'); },
- { formatLength: 'short', selector: 'date and time' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text similar to the results that follow
+ This example uses the default conversion options
+*/
+navigator.globalization.dateToString(new Date(), function(date)
+{
+ console.log('Date: ' + date.value);
+}, function()
+{
+ console.log('Error getting dateString.');
+}, {formatLength: 'short', selector: 'date and time'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Date: 9/25/2012 4:21PM
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US locale and the selected
- // currency is United States Dollars, this example outputs
- // text similar to the results that follow.
-
- navigator.globalization.getCurrencyPattern(
- 'USD',
- function (pattern) {
- console.log('pattern: ' + pattern.pattern);
- console.log('code: ' + pattern.code);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
- },
- function () { console.log('Error getting pattern.'); }
- );
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ and the selected currency is United States Dollars,
+ this outputs the text similar to the results that follow
+*/
+navigator.globalization.getCurrencyPattern('USD', function(pattern)
+{
+ console.log('pattern: ' + pattern.pattern);
+ console.log('code: ' + pattern.code);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
+}, function()
+{
+ console.log('Error getting pattern.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>pattern: $#,##0.##;($#,##0.##)
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this example logs the names of months, as per locale settings,
- // with text similar to the results that follow.
-
- navigator.globalization.getDateNames(
- function (names) {
- for (var i = 0; i < names.value.length; i++) {
- console.log('month: ' + names.value[i]);
- }
- },
- function () { console.log('Error getting names.'); },
- { type: 'wide', item: 'months' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this example logs the names of months, as per locale settings
+ with text similar to the results that follow
+*/
+navigator.globalization.getDateNames(function(names)
+{
+ for (var i = 0; i < names.value.length; i++)
+ {
+ console.log('month: ' + names.value[i]);
+ }
+}, function()
+{
+ console.log('Error getting names.');
+}, {type: 'wide', item: 'months'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>month: January
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // This example displays the locale date pattern.
- // When the browser is set to the en_US locale,
- // the text displayed is similar to the results that follow.
-
- function checkDatePattern () {
- navigator.globalization.getDatePattern(
- function (date) { console.log('Date pattern: ' + date.pattern); },
- function () { console.log('Error getting pattern'); },
- { formatLength: 'short', selector: 'date and time' }
- );
- }
-
- checkDatePattern();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ This example displays the locale date pattern
+ When the browser is set to the en-US locale,
+ this outputs the text similar to the results that follow
+*/
+function checkDatePattern()
+{
+ navigator.globalization.getDatePattern(function(date)
+ {
+ console.log('Date pattern: ' + date.pattern);
+ }, function()
+ {
+ console.log('Error getting pattern');
+ }, {formatLength: 'short', selector: 'date and time'});
+}
+
+checkDatePattern();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Date pattern: M/d/yyyy h:mm a
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this outputs the text similar to "day: 1".
-
- navigator.globalization.getFirstDayOfWeek(
- function (day) { console.log('day: ' + day.value); },
- function () { console.log('Error getting first day of week.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this outputs the text similar to "day: 1"
+*/
+navigator.globalization.getFirstDayOfWeek(function(day)
+{
+ console.log('day: ' + day.value);
+}, function()
+{
+ console.log('Error getting first day of week.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>day: 1
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this example outputs the text
- // similar to the results that follow.
-
- navigator.globalization.getNumberPattern(
- function (pattern) {
- console.log('pattern: ' + pattern.pattern);
- console.log('symbol: ' + pattern.symbol);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('positive: ' + pattern.positive);
- console.log('negative: ' + pattern.negative);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
- },
- function() { console.log('An error occurred.'); },
- { type: 'decimal' }
- );
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this outputs the text similar to the results that follow
+*/
+navigator.globalization.getNumberPattern(function(pattern)
+{
+ console.log('pattern: ' + pattern.pattern);
+ console.log('symbol: ' + pattern.symbol);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('positive: ' + pattern.positive);
+ console.log('negative: ' + pattern.negative);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
+}, function()
+{
+ console.log('An error occurred.');
+}, {type: 'decimal'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>pattern: #,##0.###
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // During the summer, and if the browser
- // is set to a DST-enabled timezone,
- // this should log text similar to "dst: true":
-
- navigator.globalization.isDayLightSavingsTime(
- new Date(),
- function (date) { console.log('dst: ' + date.dst); },
- function () { console.log('Error getting the DST state.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ During the summer, and if the browser is set to a DST-enabled timezone,
+ this logs text similar to "dst: true"
+*/
+navigator.globalization.isDayLightSavingsTime(new Date(), function(date)
+{
+ console.log('dst: ' + date.dst);
+}, function()
+{
+ console.log('Error getting the DST state.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>dst: true
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this code displays the results that follow.
-
- navigator.globalization.numberToString(
- 3.1415926,
- function (number) { console.log('decimal number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
-
- navigator.globalization.numberToString(
- 1000003,
- function (number) { console.log('big decimal number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
-
- navigator.globalization.numberToString(
- 0.3183099,
- function (number) { console.log('percentile: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'percent' }
- );
-
- navigator.globalization.numberToString(
- 1099.95,
- function (number) { console.log('currency: ' + number.value); },
- function () { console.log('Error getting number'); },
- { type: 'currency' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this code displays the results that follow
+*/
+navigator.globalization.numberToString(3.1415926, function(number)
+{
+ console.log('decimal number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+
+navigator.globalization.numberToString(1000003, function(number)
+{
+ console.log('big decimal number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+
+navigator.globalization.numberToString(0.3183099, function(number)
+{
+ console.log('percentile: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'percent'});
+
+navigator.globalization.numberToString(1099.95, function(number)
+{
+ console.log('currency: ' + number.value);
+}, function()
+{
+ console.log('Error getting number');
+}, {type: 'currency'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>decimal number: 3.142
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // when the browser is set to the en_US locale,
- // this example outputs text similar to the results that follow.
- // Note that the month integer is one less than the string,
- // as the month integer represents an array index.
-
- navigator.globalization.stringToDate(
- '9/25/2012',
- function (date) {
- console.log('month: ' + date.month +
- ', day: ' + date.day +
- ', year: ' + date.year)
- },
- function () { console.log('Error getting date.'); },
- { selector: 'date' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this example outputs text similar to the results that follow
+ Note that the month integer is one less than the string,
+ as the month integer represents an array index
+*/
+navigator.globalization.stringToDate('9/25/2012', function(date)
+{
+ console.log('month: ' + date.month +
+ ', day: ' + date.day +
+ ', year: ' + date.year)
+}, function()
+{
+ console.log('Error getting date.');
+}, {selector: 'date'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>month: 8, day: 25, year: 2012
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this should display the text similar to the results that follow.
-
- navigator.globalization.stringToNumber(
- '1234.56',
- function (number) { console.log('number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this displays the text similar to the results that follow
+*/
+navigator.globalization.stringToNumber('1234.56', function(number)
+{
+ console.log('number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>number: 1234.56
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Media API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Media API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Media">
void stop();
};</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myMedia = new Media(src, successCallback, errorCallback, statusCallback);</pre>
</div>
<div class="constructors">
<h4 id="Media::constructor">Constructors</h4>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- positionSuccessCallback = function(position) {
- console.log('Current position is ' + position);
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- setTimeout(function() {
- myMedia.getCurrentPosition(positionSuccessCallback);
- }, 2000);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+positionSuccessCallback = function(position)
+{
+ console.log('Current position is ' + position);
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+setTimeout(function()
+{
+ myMedia.getCurrentPosition(positionSuccessCallback);
+}, 2000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been played back.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.);
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- var duration = myMedia.getDuration();
- console.log('Audio duration is ' + duration);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+var duration = myMedia.getDuration();
+console.log('Audio duration is ' + duration);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio duration is 281.035
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- statusCallback = function(status) {
- if (status == Media.MEDIA_PAUSED) {
- console.log('Audio file has been paused');
- }
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
-
- myMedia.play();
-
- //Pause after 2 seconds
- setTimeout(function() {
- myMedia.pause();
- }, 2000);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+statusCallback = function(status)
+{
+ if (status == Media.MEDIA_PAUSED)
+ {
+ console.log('Audio file has been paused');
+ }
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
+
+myMedia.play();
+
+/* Pause after 2 seconds */
+setTimeout(function()
+{
+ myMedia.pause();
+}, 2000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been paused.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
- myMedia.play();
- </pre>
+myMedia.play();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been played back.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been stopped or released.');
- }
-
- errorCallback = function(err) {
- console.log('An error occurred: ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
- myMedia.stop();
- myMedia.release();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been stopped or released.');
+}
+
+errorCallback = function(err)
+{
+ console.log('An error occurred: ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+myMedia.stop();
+myMedia.release();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been stopped or released.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('An error occurred: ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- //SeekTo to 10 seconds after 5 seconds
- setTimeout(function() {
- myMedia.seekTo(10000);
- console.log('Playback position has been set to 10 seconds.');
- }, 5000);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('An error occurred: ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* SeekTo to 10 seconds after 5 seconds */
+setTimeout(function()
+{
+ myMedia.seekTo(10000);
+ console.log('Playback position has been set to 10 seconds.');
+}, 5000);
</pre>
</div>
<div class="output">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- // Mute volume after 2 seconds
- setTimeout(function() {
- myMedia.setVolume(0.0);
- console.log('Playback volume has been muted.');
- }, 2000);
-
- // Set volume to 1.0 after 5 seconds
- setTimeout(function() {
- myMedia.setVolume(1.0);
- console.log('Playback volume has been set to 1.0.');
- }, 5000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* Mute volume after 2 seconds */
+setTimeout(function()
+{
+ myMedia.setVolume(0.0);
+ console.log('Playback volume has been muted.');
+}, 2000);
+
+/* Set volume to 1.0 after 5 seconds */
+setTimeout(function()
+{
+ myMedia.setVolume(1.0);
+ console.log('Playback volume has been set to 1.0.');
+}, 5000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Playback volume has been muted.
http://tizen.org/privilege/mediacapture
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Started recording an audio file.');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Started recording an audio file.');
+}
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
- var src = 'recordAudio.mp3';
- var myRecMedia = new Media(src, successCallback, errorCallback);
+var src = 'recordAudio.mp3';
+var myRecMedia = new Media(src, successCallback, errorCallback);
- myRecMedia.startRecord();
- </pre>
+myRecMedia.startRecord();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Started recording an audio file.
http://tizen.org/privilege/mediacapture
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Started recording an audio file.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'recordAudio.mp3';
- var myRecMedia = new Media(src, successCallback, errorCallback);
-
- myRecMedia.startRecord();
-
- // Stop recording after 10 seconds
- setTimeout(function() {
- myRecMedia.stopRecord();
- console.log('Stopped recording an audio file.');
- }, 10000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Started recording an audio file.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'recordAudio.mp3';
+var myRecMedia = new Media(src, successCallback, errorCallback);
+
+myRecMedia.startRecord();
+
+/* Stop recording after 10 seconds */
+setTimeout(function()
+{
+ myRecMedia.stopRecord();
+ console.log('Stopped recording an audio file.');
+}, 10000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Started recording an audio file.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been stopped.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- // Stop after 10 seconds
- setTimeout(function() {
- myMedia.stop();
- }, 10000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been stopped.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* Stop after 10 seconds */
+setTimeout(function()
+{
+ myMedia.stop();
+}, 10000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio playback has been stopped.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>NetworkInformation API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>NetworkInformation API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::NetworkInformation">
http://tizen.org/privilege/telephony
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function checkConnection() {
- var networkState = navigator.connection.type;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function checkConnection()
+{
+ var networkState = navigator.connection.type;
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
- alert('Connection type: ' + states[networkState]);
- }
+ var states = {};
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+ alert('Connection type: ' + states[networkState]);
+}
- checkConnection();
- </pre>
+checkConnection();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Connection type: Cell 3G connection
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.UNKNOWN);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.UNKNOWN);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>unknown
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.ETHERNET);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.ETHERNET);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>ethernet
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.WIFI);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.WIFI);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>wifi
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_2G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_2G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>2g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_3G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_3G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>3g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_4G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_4G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>4g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>cellular
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.NONE);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.NONE);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>none
Original documentation: <a href="https://www.npmjs.com/package/cordova-plugin-network-information#online">Cordova online event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- document.addEventListener('online', onOnline, false);
- }
+function onDeviceReady()
+{
+ document.addEventListener('online', onOnline, false);
+}
- function onOnline() {
- // Handle the online event
- }
- </pre>
+function onOnline()
+{
+ /* Handle the online event */
+}
+</pre>
</div>
</div>
<div class="interface" id="OfflineEventCallback">
Original documentation: <a href="https://www.npmjs.com/package/cordova-plugin-network-information#offline">Cordova offline event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- document.addEventListener('offline', onOffline, false);
- }
+function onDeviceReady()
+{
+ document.addEventListener('offline', onOffline, false);
+}
- function onOffline() {
- // Handle the offline event
- }
- </pre>
+function onOffline()
+{
+ /* Handle the offline event */
+}
+</pre>
</div>
</div>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //The data provider, a native application, should be pre-installed and launched.
- //The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer).
- //In this example, the DictionaryDataControlProvider native sample application is used as a data control provider.
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ The data provider, a native application, should be pre-installed and launched
+ The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer)
+ In this example, the DictionaryDataControlProvider native sample application is used as a data control provider
+*/
- //Gets SQL type DataControlConsumerObject
- try {
- var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- // Gets MAP type DataControlConsumerObject
- try {
- globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+/* Gets SQL type DataControlConsumerObject */
+try
+{
+ var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
+}
+catch (err)
+{
+ console.log(err.name +": " + err.message);
+}
+/* Gets MAP type DataControlConsumerObject */
+try
+{
+ globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
+}
+catch (err)
+{
+ console.log(err.name +": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id, insertRowId)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id, insertRowId)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- var rowData = {
- columns : ["WORD", "WORD_DESC"] ,
- values : ["'tizen1'", "'tizen2'"]
- };
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'tizen2'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- var rowData = {
- columns : ["WORD", "WORD_DESC"] ,
- values : ["'tizen1'", "'Web apps platform!'"]
- };
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'Web apps platform!'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::select">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function getValueSuccessCB(result, id)
- {
- console.log("getValueSuccessCB result.length: " + result.length);
- var length = result.length;
- for (var i = 0; i < length; i++)
- {
- var rowData = "| ";
- var j = 0;
- for (j = 0; j < result[i].columns.length; j++)
- {
- rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
- }
- console.log(rowData);
- }
- }
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function getValueSuccessCB(result, id)
+{
+ console.log("getValueSuccessCB result.length: " + result.length);
+ var length = result.length;
+ for (var i = 0; i < length; i++)
+ {
+ var rowData = "| ";
+ var j = 0;
+ for (j = 0; j < result[i].columns.length; j++)
+ {
+ rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
+ }
+ console.log(rowData);
+ }
+}
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // globalSQLConsumer and globalReqId should be defined before.
- // Increases globalReqId for uniqueness
- globalReqId++;
- var columns = ["WORD", "WORD_DESC" ];
- var whereClause = "1";
- console.log("----- Calling for ascending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC ASC");
- setTimeout( function() {
- console.log("----- Calling descending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC DESC");
- }, 1000);
- }
- catch (err) {
- console.log (err.name +": " + err.message);
- }
-
- </pre>
+try
+{
+ /* globalSQLConsumer and globalReqId should be defined before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ var columns = ["WORD", "WORD_DESC"];
+ var whereClause = "1";
+ console.log("----- Calling for ascending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC ASC");
+ setTimeout(function()
+ {
+ console.log("----- Calling descending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC DESC");
+ }, 1000);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::removeValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::getValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function getValueSuccessCB(result, id)
- {
- console.log(result.length + ":" + result[0]);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function getValueSuccessCB(result, id)
+{
+ console.log(result.length + ":" + result[0]);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::updateValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
2.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var req = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt");
- req.httpHeader["Pragma"] = "no-cache";
- req.httpHeader["Cookie"] = "version=1; Skin=new";
- req.httpHeader["X-Agent"] = "Tizen Sample App";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var req = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt");
+req.httpHeader["Pragma"] = "no-cache";
+req.httpHeader["Cookie"] = "version=1; Skin=new";
+req.httpHeader["X-Agent"] = "Tizen Sample App";
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Check if Download API is supported not on a device.
- var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
- if (download_api_capability === false) {
- console.log("Download API is not supported on this device.");
- return;
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Check whether Download API is supported on a device */
+var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
+if (download_api_capability === false)
+{
+ console.log("Download API is not supported on this device.");
- var listener = {
- onprogress: function(id, receivedSize, totalSize) {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id) {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id) {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, fullPath) {
- console.log('Completed with id: ' + id + ', full path: ' + fullPath);
- },
- onfailed: function(id, error) {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
- };
+ return;
+}
- // Starts downloading the file from the Web with the corresponding callbacks.
- var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
- var downloadId = tizen.download.start(downloadRequest, listener);
+var listener =
+{
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, fullPath)
+ {
+ console.log('Completed with id: ' + id + ', full path: ' + fullPath);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
+};
- // If you want to download a large file through Wi-Fi,
- var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
- var wifiDownloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
+/* Starts downloading the file from the Web with the corresponding callbacks */
+var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
+var downloadId = tizen.download.start(downloadRequest, listener);
- if (wifi_capability === true) {
- var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
- } else {
- // If you call tizen.download.start(), NotSupportedError will be thrown.
- console.log("This device doesn't support Download API through Wi-Fi.");
- }
+/* If you want to download a large file through Wi-Fi */
+var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
+var wifiDownloadRequest = new tizen.DownloadRequest(
+ "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
- </pre>
+if (wifi_capability === true)
+{
+ var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
+}
+else
+{
+ /* If you call tizen.download.start(), NotSupportedError will be thrown */
+ console.log("This device doesn't support Download API through Wi-Fi.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::cancel">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Cancels the ongoing download operation with the specified ID.
- tizen.download.cancel(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Cancels the ongoing download operation with the specified ID */
+tizen.download.cancel(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::pause">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Pauses the ongoing download operation with the specified ID.
- tizen.download.pause(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Pauses the ongoing download operation with the specified ID */
+tizen.download.pause(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::resume">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Resumes the paused download operation with the specified ID.
- tizen.download.resume(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Resumes the paused download operation with the specified ID */
+tizen.download.resume(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getState">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the state of the download operation with the given ID.
- var state = tizen.download.getState(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the state of the download operation with the given ID */
+var state = tizen.download.getState(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getDownloadRequest">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the download request information with the given ID.
- var downloadRequest = tizen.download.getDownloadRequest(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the download request information with the given ID */
+var downloadRequest = tizen.download.getDownloadRequest(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getMIMEType">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Get the MIME type of the download operation with the given ID.
- var MIMEtype = tizen.download.getMIMEType(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Get the MIME type of the download operation with the given ID */
+var MIMEtype = tizen.download.getMIMEType(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::setListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- onprogress: function(id, receivedSize, totalSize) {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id) {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id) {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, fileName) {
- console.log('Completed with id: ' + id + ', file name: ' + fileName);
- },
- onfailed: function(id, error) {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, fileName)
+ {
+ console.log('Completed with id: ' + id + ', file name: ' + fileName);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
+};
- // Start downloading the html file on the web with the corresponding callbacks.
- var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
- downloadId = tizen.download.start(downloadRequest);
+/* Start downloading the html file on the web with the corresponding callbacks */
+var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
+downloadId = tizen.download.start(downloadRequest);
- // Add the listener.
- tizen.download.setListener(downloadId, listener);
- </pre>
+/* Add the listener */
+tizen.download.setListener(downloadId, listener);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSuccess(exifInfo) {
- console.log("success to get Exif information object");
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occurred: " + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSuccess(exifInfo)
+{
+ console.log("success to get Exif information object");
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
<dt class="method" id="ExifManager::saveExifInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSaveSuccess() {
- console.log("success to save Exif information");
- }
-
- // Defines error callback
- function onSaveError(error) {
- console.log("error occur" + error.name);
- }
-
- // Defines success callback
- function onSuccess(exifInfo) {
- console.log("success to get Exif information object");
- exifInfo.orientation = "ROTATE_90";
- tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occur" + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
-
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSaveSuccess()
+{
+ console.log("success to save Exif information");
+}
+
+/* Defines error callback */
+function onSaveError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+/* Defines success callback */
+function onSuccess(exifInfo)
+{
+ console.log("success to get Exif information object");
+ exifInfo.orientation = "ROTATE_90";
+ tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
<dt class="method" id="ExifManager::getThumbnail">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSuccess(thumbData) {
- console.log("got thumbnail data of JPEG file");
- if (thumbData) {
- var img = new Image();
- img.src = thumbData;
- document.body.appendChild(img);
- }
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occur" + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
-
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSuccess(thumbData)
+{
+ console.log("got thumbnail data of JPEG file");
+ if (thumbData)
+ {
+ var img = new Image();
+ img.src = thumbData;
+ document.body.appendChild(img);
+ }
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- }
-
- var testFile = documentsDir.createFile("test.txt");
-
- if (testFile != null) {
- testFile.openStream(
- "w",
- function(fs) {
- fs.write("HelloWorld");
- fs.close();
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
+</pre>
</div>
</li></ul>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.filesystem.resolve(
- 'images',
- function(dir) {
- console.log("Mount point Name is " + dir.path);
- }, function(e) {
- console.log("Error: " + e.message);
- }, "r"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.filesystem.resolve('images', function(dir)
+{
+ console.log("Mount point Name is " + dir.path);
+}, function(e)
+{
+ console.log("Error: " + e.message);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::getStorage">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onStorage(storage) {
- // Do something
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onStorage(storage)
+{
+ /* Do something */
+}
- function onStorageError(e) {
- console.log("Storage not found!" + e.message);
- }
+function onStorageError(e)
+{
+ console.log("Storage not found!" + e.message);
+}
- tizen.filesystem.getStorage("music", onStorage, onStorageError);
- </pre>
+tizen.filesystem.getStorage("music", onStorage, onStorageError);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::listStorages">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function alertForCorruptedRemovableDrives(storages) {
- for (var i = 0; i < storages.length; i++) {
- if (storages[i].type != "EXTERNAL")
- continue;
- if (storages[i].state == "UNMOUNTABLE")
- console.log("External drive " + storages[i].label + " is corrupted.");
- }
- }
-
- tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function alertForCorruptedRemovableDrives(storages)
+{
+ for (var i = 0; i < storages.length; i++)
+ {
+ if (storages[i].type != "EXTERNAL")
+ continue;
+ if (storages[i].state == "UNMOUNTABLE")
+ console.log("External drive " + storages[i].label + " is corrupted.");
+ }
+}
+
+tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::addStorageStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watchID;
- function onStorageStateChanged(storage) {
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watchID;
+function onStorageStateChanged(storage)
+{
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+}
- watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
- </pre>
+watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::removeStorageStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watchID;
- function onStorageStateChanged(storage) {
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- tizen.filesystem.removeStorageStateChangeListener(watchID);
- }
-
- watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watchID;
+function onStorageStateChanged(storage)
+{
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+ tizen.filesystem.removeStorageStateChangeListener(watchID);
+}
+
+watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- // alerts each name of dir's contents
- console.log(files[i].name);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
-
- // list directory contents
- dir.listFiles(onsuccess, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ /* Alerts each name of dir's contents */
+ console.log(files[i].name);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+
+/* List directory contents */
+dir.listFiles(onsuccess, onerror);
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // list directory contents
- dir.listFiles(onsuccess, onerror);
-
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- // prints the file parent, should contain the
- // same value for all the files in the loop
- console.log("All the files should have the same parent " +
- files[i].parent);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* List directory contents */
+dir.listFiles(onsuccess, onerror);
+
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ /*
+ Prints the file parent, must contain the
+ same value for all the files in the loop
+ */
+ console.log("All the files should have the same parent " +
+ files[i].parent);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+</pre>
</div>
</li>
<li class="attribute" id="File::readOnly">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // lists directory contents
- dir.listFiles(onsuccess, onerror);
-
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].readOnly)
- console.log("Cannot write to file " + files[i].name);
- else
- console.log("Can write to file " + files[i].name);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Lists directory contents */
+dir.listFiles(onsuccess, onerror);
+
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].readOnly)
+ console.log("Cannot write to file " + files[i].name);
+ else
+ console.log("Can write to file " + files[i].name);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+</pre>
</div>
</li>
<li class="attribute" id="File::isFile">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(file.modified); // displays the modification timestamp
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(file.modified); /* Displays the modification timestamp */</pre>
</div>
</li>
<li class="attribute" id="File::path">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(file.path); // should be 'music/' if the file is music/foo.mp3
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(file.path); /* Must be 'music/' if the file is music/foo.mp3 */</pre>
</div>
</li>
<li class="attribute" id="File::name">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // should be foo.mp3 if the file path is music/foo.mp3
- console.log(file.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Must be foo.mp3 if the file path is music/foo.mp3 */
+console.log(file.name);
+</pre>
</div>
</li>
<li class="attribute" id="File::fullPath">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // should be music/track1.mp3 if the file is music/track1.mp3
- console.log(file.fullPath);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Must be music/track1.mp3 if the file is music/track1.mp3 */
+console.log(file.fullPath);
+</pre>
</div>
</li>
<li class="attribute" id="File::fileSize">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // displays the file size
- console.log(file.fileSize);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Displays the file size */
+console.log(file.fileSize);
+</pre>
</div>
</li>
<li class="attribute" id="File::length">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // '3' if the directory contains two files and one sub-directory
- console.log(file.length);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* '3' if the directory contains two files and one sub-directory */
+console.log(file.length);
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file) {
- var audio = new Audio(file.toURI());
- audio.play();
- console.log(file.toURI());
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
+{
+ var audio = new Audio(file.toURI());
+ audio.play();
+ console.log(file.toURI());
+});
+</pre>
</div>
</dd>
<dt class="method" id="File::listFiles">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- console.log("There are " + files.length + " in the selected folder");
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- "documents",
- function(dir) {
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error " + e.message);
- }, "r"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ console.log("There are " + files.length + " in the selected folder");
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve("documents", function(dir)
+{
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error " + e.message);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="File::openStream">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- }
-
- var testFile = documentsDir.createFile("test.txt");
- if (testFile != null) {
- testFile.openStream(
- "w",
- function(fs) {
- fs.write("HelloWorld");
- fs.close();
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir; dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::readAsText">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- if (files[i].isDirectory == false)
- files[i].readAsText(
- function(str) {
- console.log("The file content " + str);
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- var documentsDir;
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ if (files[i].isDirectory == false)
+ {
+ files[i].readAsText(function(str)
+ {
+ console.log("The file content " + str);
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+var documentsDir;
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::copyTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory == false) {
- documentsDir.copyTo(files[i].fullPath,
- "images/backup/" + files[i].name,
- false,
- function() {console.log("file copied");});
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.copyTo(files[i].fullPath,
+ "images/backup/" + files[i].name, false,
+ function() {console.log("file copied");});
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::moveTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory == false) {
- documentsDir.moveTo(files[i].fullPath,
- "images/newFolder/" + files[i].name,
- false,
- function() {console.log("file moved");});
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred during listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.moveTo(files[i].fullPath,
+ "images/newFolder/" + files[i].name, false,
+ function() {console.log("file moved");});
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred during listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::createDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var dir; //Directory object obtained from filesystem API
- var newDir = dir.createDirectory("newDir");
- var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var dir; /* Directory object obtained from filesystem API */
+var newDir = dir.createDirectory("newDir");
+var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
+</pre>
</div>
</dd>
<dt class="method" id="File::createFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var newFile = dir.createFile("newFilePath");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">var newFile = dir.createFile("newFilePath");</pre>
</div>
</dd>
<dt class="method" id="File::resolve">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var file;
- // Resolves helloWorld.doc file that is located in the
- // documents root location
- tizen.filesystem.resolve(
- 'documents',
- function(dir) { file = dir.resolve("helloWorld.doc");},
- function(e) { console.log("Error" + e.message);},
- "rw");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var file;
+/*
+ Resolves helloWorld.doc file that is located in the
+ documents root location
+*/
+tizen.filesystem.resolve('documents', function(dir)
+{
+ file = dir.resolve("helloWorld.doc");
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::deleteDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory) {
- documentsDir.deleteDirectory(
- files[i].fullPath,
- false,
- function() {
- console.log("Directory Deleted");
- }, function(e) {
- console.log("Error" + e.message);
- });
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory)
+ {
+ documentsDir.deleteDirectory(files[i].fullPath, false, function()
+ {
+ console.log("Directory Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::deleteFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (!files[i].isDirectory) {
- documentsDir.deleteFile(
- files[i].fullPath,
- function() {
- console.log("File Deleted");
- }, function(e) {
- console.log("Error" + e.message);
- });
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- var documentsDir;
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (!files[i].isDirectory)
+ {
+ documentsDir.deleteFile(files[i].fullPath, function()
+ {
+ console.log("File Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+var documentsDir;
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess,onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> if (stream.eof) {
- // file has been read completely
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+if (stream.eof)
+{
+ /* File has been read completely */
+}
+</pre>
</div>
</li>
<li class="attribute" id="FileStream::position">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(stream.position); // displays current stream position
- // alters current stream position to the begin of the file,
- // like seek() in C
- stream.position = 0;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(stream.position); /* Displays current stream position */
+/*
+ Alters current stream position to the begin of the file,
+ like seek() in C
+*/
+stream.position = 0;
+</pre>
</div>
</li>
<li class="attribute" id="FileStream::bytesAvailable">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(stream.bytesAvailable); // displays the available bytes to be read
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(stream.bytesAvailable); /* Displays the available bytes to be read */</pre>
</div>
</li>
</ul>
http://tizen.org/privilege/filesystem.read
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> stream.close(); // closes this stream, no subsequent access to stream allowed
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+stream.close(); /* Closes this stream, no subsequent access to stream allowed */
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::read">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var text = stream.read(file.fileSize);
- stream.close();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var text = stream.read(file.fileSize);
+stream.close();
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::readBytes">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // reads up to 256 bytes from the stream
- var raw = stream.readBytes(256);
- for (var i = 0; i < raw.length; i++) {
- // raw[i] contains the i-th byte of the current data chunk
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Reads up to 256 bytes from the stream */
+var raw = stream.readBytes(256);
+for (var i = 0; i < raw.length; i++)
+{
+ /* raw[i] contains the i-th byte of the current data chunk */
+}
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::readBase64">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // reads up to 256 bytes from the stream
- var base64 = stream.readBase64(256);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Reads up to 256 bytes from the stream */
+var base64 = stream.readBase64(256);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::write">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var text = "Hello world";
- stream.write(text);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var text = "Hello world";
+stream.write(text);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::writeBytes">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var bytes = in.readBytes(256);
- // writes the bytes read from in to out
- out.writeBytes(bytes);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var bytes = in.readBytes(256);
+/* Writes the bytes read from in to out */
+out.writeBytes(bytes);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::writeBase64">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var base64 = in.readBase64(256);
- // writes the base64 data read from in to out
- out.writeBase64(base64);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var base64 = in.readBase64(256);
+/* Writes the base64 data read from in to out */
+out.writeBase64(base64);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
- function onSave() {
- console.log("Successfully saved data");
- }
+function onSave()
+{
+ console.log("Successfully saved data");
+}
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::removeData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onSave() {
-
- // do something
-
- // Dictionary does not require package ID because the
- // application which is calling removeData() saved "data1"
- tizen.keymanager.removeData({
- "name": data_name
- });
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onSave()
+{
+ /* Do something */
+
+ /*
+ Dictionary does not require package ID because the
+ application which is calling removeData() saved "data1"
+ */
+ tizen.keymanager.removeData({"name": data_name});
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- if (aliases.length != 0) {
- // Assuming the application calling removeData() has permission
- // to remove aliases[0]
- var app_data = tizen.keymanager.removeData(aliases[0]);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+if (aliases.length != 0)
+{
+ /*
+ Assuming the application calling removeData() has permission
+ to remove aliases[0]
+ */
+ var app_data = tizen.keymanager.removeData(aliases[0]);
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::getData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onSave() {
- // Dictionary does not require package ID because the
- // application which is calling getData() saved "data1"
- var app_data = tizen.keymanager.getData({
- "name": data_name
- });
- console.log("App data: " + app_data + " was retrieved");
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onSave()
+{
+ /*
+ Dictionary does not require package ID because the
+ application which is calling getData() saved "data1"
+ */
+ var app_data = tizen.keymanager.getData({"name": data_name});
+ console.log("App data: " + app_data + " was retrieved");
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- if (aliases.length != 0) {
- // Assuming the application calling getData() has permission to read
- // aliases[0]
- var app_data = tizen.keymanager.getData(aliases[0]);
- console.log("App data: " + app_data + " was retrieved");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+if (aliases.length != 0)
+{
+ /*
+ Assuming the application calling getData() has permission to read
+ aliases[0]
+ */
+ var app_data = tizen.keymanager.getData(aliases[0]);
+ console.log("App data: " + app_data + " was retrieved");
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::getDataAliasList">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- console.log("aliases: ");
- for (var i = 0; i < aliases.length; i++) {
- console.log("Package ID: " + aliases[i].packageId + ", Name: "
- + aliases[i].name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+console.log("aliases: ");
+for (var i = 0; i < aliases.length; i++)
+{
+ console.log("Package ID: " + aliases[i].packageId + ", Name: "
+ + aliases[i].name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::setPermission">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onPermissionSet() {
- console.log("Successfully set permssion");
- }
-
- function onSave() {
- // Dictionary does not require package ID because an
- // application can only set permission for data which it saved
- tizen.keymanager.setPermission({
- "name": data_name
- }, "9PdoiICQ4c", "READ_REMOVE", onPermissionSet);
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onPermissionSet()
+{
+ console.log("Successfully set permission");
+}
+
+function onSave()
+{
+ /*
+ Dictionary does not require package ID because an
+ application can only set permission for data which it saved
+ */
+ tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- function onPermissionSet() {
- console.log("Successfully set permssion");
- }
-
- if (aliases.length != 0) {
- // Check that the application calling setPermission() saved aliases[0] into
- // the KeyManager
- if (aliases[0].packageId === tizen.package.getPackageInfo().id) {
- tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
- } else {
- console.log("This application did not save aliases[0] into the KeyManager");
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+function onPermissionSet()
+{
+ console.log("Successfully set permssion");
+}
+
+if (aliases.length != 0)
+{
+ /*
+ Check that the application calling setPermission() saved aliases[0] into
+ the KeyManager
+ */
+ if (aliases[0].packageId === tizen.package.getPackageInfo().id)
+ {
+ tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+ }
+ else
+ {
+ console.log("This application did not save aliases[0] into the KeyManager");
+ }
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the LocalMessagePort instance with the specified message port name
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the LocalMessagePort instance with the specified message port name */
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestTrustedLocalMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the LocalMessagePort instance with the specified message port name
- var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the LocalMessagePort instance with the specified message port name */
+var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestRemoteMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the RemoteMessagePort instance with the specified message port name
- var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the RemoteMessagePort instance with the specified message port name */
+var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestTrustedRemoteMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the RemoteMessagePort instance with the specified message port name.
- var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the RemoteMessagePort instance with the specified message port name */
+var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onreceived(data, remoteMsgPort) {
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onreceived(data, remoteMsgPort)
+{
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+}
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- </pre>
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+</pre>
</div>
</dd>
<dt class="method" id="LocalMessagePort::removeMessagePortListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- // Communication routines of your app...
- localMsgPort.removeMessagePortListener(watchId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+/* Communication routines of your app */
+
+localMsgPort.removeMessagePortListener(watchId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sends string message
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
- localMsgPort.addMessagePortListener(function(items, remoteport) {
- // ...
- if(remoteport !== null) {
- remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
- }
- });
- // stream - FileStream object
- var bytePockets = [], byteCount = 0, i = 0;
- while(byteCount stream.bytesAvailable - 256) {
- bytePockets[i] = stream.readBytes(256);
- byteCount+=256;
- i++;
- }
- bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
-
- var messagePortPockets = [{key: "key1", value: "val1"},
- {key: "key2", value: ["val2", "val3", "val4"]},
- {key: "key3", value: bytePockets[0]},
- {key: "key4", value: bytePockets}];
- remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sends string message */
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
+localMsgPort.addMessagePortListener(function(items, remoteport)
+{
+ /* ... */
+ if (remoteport !== null)
+ {
+ remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
+ }
+});
+/* stream - FileStream object */
+var bytePockets = [], byteCount = 0, i = 0;
+while (byteCount < stream.bytesAvailable - 256)
+{
+ bytePockets[i] = stream.readBytes(256);
+ byteCount+=256;
+ i++;
+}
+bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
+
+var messagePortPockets = [{key: "key1", value: "val1"},
+ {key: "key2", value: ["val2", "val3", "val4"]},
+ {key: "key3", value: bytePockets[0]},
+ {key: "key4", value: bytePockets}];
+remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // MessagePortCallback instance
- function onreceived(data, remoteMsgPort) {
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
- }
-
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* MessagePortCallback instance */
+function onreceived(data, remoteMsgPort)
+{
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+}
+
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var onInstallation = {
- onprogress: function(packageId, percentage) {
- console.log("On installation(" + packageId + ") : progress(" + percentage + ")");
- },
- oncomplete: function(packageId) {
- console.log("Installation(" + packageId + ") Complete");
- }
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var onInstallation =
+{
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On installation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Installation(" + packageId + ") Complete");
+ }
+}
- var onError = function (err) {
- console.log("Error occurred on installation : " + err.name);
- }
+var onError = function(err)
+{
+ console.log("Error occurred on installation: " + err.name);
+}
- // Let's assume that the "test.wgt" file exists in the downloads directory
- tizen.filesystem.resolve("downloads/test.wgt",
- function (file) {
- console.log("file URI : " + file.toURI());
- tizen.package.install(file.toURI(), onInstallation, onError);
- },
- function (err) {
- console.log("Error occurred on resolve : " + err.name);
- },
- "r");
-
- </pre>
+/* Let's assume that the "test.wgt" file exists in the downloads directory */
+tizen.filesystem.resolve("downloads/test.wgt", function(file)
+{
+ console.log("file URI: " + file.toURI());
+ tizen.package.install(file.toURI(), onInstallation, onError);
+}, function(err)
+{
+ console.log("Error occurred on resolve: " + err.name);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::uninstall">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var onUninstallation = {
- onprogress: function(packageId, percentage) {
- console.log("On Uninstallation(" + packageId + ") : progress(" + percentage + ")");
- },
- oncomplete: function(packageId) {
- console.log("Uninstallation(" + packageId + ") Complete");
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var onUninstallation =
+{
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Uninstallation(" + packageId + ") Complete");
+ }
+};
- var onError = function (err) {
- console.log("Error occurred on installation : " + err.name);
- };
+var onError = function(err)
+{
+ console.log("Error occurred on installation: " + err.name);
+};
- // Let's assume that the package ID to uninstall is "testapp001"
- tizen.package.uninstall("testapp001", onUninstallation, onError);
- </pre>
+/* Let's assume that the package ID to uninstall is "testapp001" */
+tizen.package.uninstall("testapp001", onUninstallation, onError);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::getPackagesInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledPackages(packages) {
- for (var i = 0; i < packages.length; i++) {
- console.log("Package id["+i+"] : " +packages[i].id);
- }
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledPackages(packages)
+{
+ for (var i = 0; i < packages.length; i++)
+ {
+ console.log("Package id[" + i + "]: " + packages[i].id);
+ }
+}
- tizen.package.getPackagesInfo(
- onListInstalledPackages,
- function (err) {console.log("Can't obtain packages list" + err.name);});
- </pre>
+tizen.package.getPackagesInfo(onListInstalledPackages, function(err)
+{
+ console.log("Can't obtain packages list" + err.name);
+});
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::getPackageInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var packageInfo = tizen.package.getPackageInfo(null);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var packageInfo = tizen.package.getPackageInfo(null);
- console.log("Current Package ID : " + packageInfo.id);
- </pre>
+console.log("Current Package ID: " + packageInfo.id);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::setPackageInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var packageEventCallback = {
- oninstalled: function(packageInfo) {
- console.log('The package ' + packageInfo.name + ' is installed');
- },
- onupdated: function(packageInfo) {
- console.log('The package ' + packageInfo.name + ' is updated');
- },
- onuninstalled: function(packageId) {
- console.log('The package ' + packageId + ' is uninstalled');
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var packageEventCallback =
+{
+ oninstalled: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is installed');
+ },
+ onupdated: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is updated');
+ },
+ onuninstalled: function(packageId)
+ {
+ console.log('The package ' + packageId + ' is uninstalled');
+ }
+};
- tizen.package.setPackageInfoEventListener(packageEventCallback);
- </pre>
+tizen.package.setPackageInfoEventListener(packageEventCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::unsetPackageInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.package.unsetPackageInfoEventListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.package.unsetPackageInfoEventListener();
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // To get total amount of system memory
- console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* To get total amount of system memory */
+console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getAvailableMemory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // To get total amount of system memory
- console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* To get total amount of system memory */
+console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
+</pre>
</div>
</dd>
<dt class="deprecated method" id="SystemInfo::getCapabilities">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var deviceCapabilities;
- deviceCapabilities = tizen.systeminfo.getCapabilities();
- if (deviceCapabilities.bluetooth) {
- console.log("Bluetooth is supported");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var deviceCapabilities;
+deviceCapabilities = tizen.systeminfo.getCapabilities();
+if (deviceCapabilities.bluetooth)
+{
+ console.log("Bluetooth is supported");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getCapability">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Checks if a device supports bluetooth API or not
- var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
- console.log(" Bluetooth = " + bluetooth);
- } catch (error) {
- console.log("Error name: " + error.name + ", message: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Checks if a device supports bluetooth API */
+ var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
+ console.log(" Bluetooth = " + bluetooth);
+}
+catch (error)
+{
+ console.log("Error name: " + error.name + ", message: " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getCount">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var count = tizen.systeminfo.getCount("SIM");
- if (count === 0) {
- console.log("There is no available SIM card.");
- } else {
- console.log("There is(are) " + count + " SIM card(s) available.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var count = tizen.systeminfo.getCount("SIM");
+if (count === 0)
+{
+ console.log("There is no available SIM card.");
+}
+else
+{
+ console.log("There is(are) " + count + " SIM card(s) available.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getPropertyValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cpu) {
- console.log("The cpu load is " + cpu.load);
- }
-
- function onErrorCallback(error) {
- console.log("An error occurred " + error.message);
- }
-
- tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cpu)
+{
+ console.log("The cpu load is " + cpu.load);
+}
+
+function onErrorCallback(error)
+{
+ console.log("An error occurred " + error.message);
+}
+
+tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cellular) {
- console.log("The status of the cellular network is " + cellular.status);
- }
-
- function onErrorCallback(error) {
- console.log("An error occurred " + error.message);
- // if telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError would be passed.
- }
-
- var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
-
- if (telephony_capability === true) {
- // onSuccessCallback will be invoked.
- tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
- } else {
- console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cellular)
+{
+ console.log("The status of the cellular network is " + cellular.status);
+}
+
+function onErrorCallback(error)
+{
+ console.log("An error occurred " + error.message);
+ /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
+}
+
+var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
+
+if (telephony_capability === true)
+{
+ /* onSuccessCallback will be invoked */
+ tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
+}
+else
+{
+ console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getPropertyValueArray">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(property) {
- console.log("The SIM's current state is " + property.state);
- }
-
- function successArrayCB(properties) {
- console.log("The number of the returned system properties is " + properties.length);
- for (var i = 0; i < properties.length; i++) {
- console.log("[" + i + "] SIM's state is " + properties[i].state);
- }
- }
-
- var count = tizen.systeminfo.getCount("SIM");
- if (count === 0) {
- console.log("This device does not provide SIM card.");
- } else if (count > 1) {
- tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
- } else {
- tizen.systeminfo.getPropertyValue("SIM", successCB);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(property)
+{
+ console.log("The SIM's current state is " + property.state);
+}
+
+function successArrayCB(properties)
+{
+ console.log("The number of the returned system properties is " + properties.length);
+ for (var i = 0; i < properties.length; i++)
+ {
+ console.log("[" + i + "] SIM's state is " + properties[i].state);
+ }
+}
+
+var count = tizen.systeminfo.getCount("SIM");
+if (count === 0)
+{
+ console.log("This device does not provide SIM card.");
+}
+else if (count > 1)
+{
+ tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
+}
+else
+{
+ tizen.systeminfo.getPropertyValue("SIM", successCB);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::addPropertyValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cpu) {
- console.log("The cpu load : " + cpu.load);
- }
-
- tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold : 0.2});
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cpu)
+{
+ console.log("The cpu load: " + cpu.load);
+}
+
+tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2});
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::addPropertyValueArrayChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var id = null;
- function onSuccessCallback(cpu) {
- console.log("New value for CPU load is " + cpu.load);
- if (id != null) { // After receiving the first notification, we clear it
- tizen.systeminfo.removePropertyValueChangeListener(id);
- }
- }
-
- id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var id = null;
+function onSuccessCallback(cpu)
+{
+ console.log("New value for CPU load is " + cpu.load);
+ if (id != null)
+ {
+ /* After receiving the first notification, clear it */
+ tizen.systeminfo.removePropertyValueChangeListener(id);
+ }
+}
+
+id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.systeminfo.getPropertyValue("CAMERA_FLASH",
- function (flash) {
- console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
- },
- function (error) {
- console.log("Error, name: " + error.name + ", message: " + error.message);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
+{
+ console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
+}, function(error)
+{
+ console.log("Error, name: " + error.name + ", message: " + error.message);
+});
+</pre>
</div>
</li>
<li class="attribute" id="SystemInfoCameraFlash::camera">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.systeminfo.getPropertyValue("CAMERA_FLASH",
- function (flash) {
- try {
- flash.setBrightness(1);
- } catch (error) {
- console.log("Setting flash brightness failed: " + error.message);
- }
- },
- function (error) {
- console.log("Error, name: " + error.name + ", message: " + error.message);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
+{
+ try
+ {
+ flash.setBrightness(1);
+ }
+ catch (error)
+ {
+ console.log("Setting flash brightness failed: " + error.message);
+ }
+}, function(error)
+{
+ console.log("Error, name: " + error.name + ", message: " + error.message);
+});
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var current_dt = tizen.time.getCurrentDateTime();
+console.log("current date/time is " + current_dt.toLocaleString());
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getLocalTimezone">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The local time zone is " + tizen.time.getLocalTimezone());
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log("The local time zone is " + tizen.time.getLocalTimezone());
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getAvailableTimezones">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var tzids = tizen.time.getAvailableTimezones();
- console.log("The device supports " + tzids.length + " time zones.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var tzids = tizen.time.getAvailableTimezones();
+console.log("The device supports " + tzids.length + " time zones.");
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getDateFormat">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var current_dt = tizen.time.getCurrentDateTime();
- var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
- if (is_leap) {
- console.log("This year is a leap year.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var current_dt = tizen.time.getCurrentDateTime();
+var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
+if (is_leap)
+{
+ console.log("This year is a leap year.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::setDateTimeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
-
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setDateTimeChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setDateTimeChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::unsetDateTimeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- tizen.time.unsetDateTimeChangeListener();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setDateTimeChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ tizen.time.unsetDateTimeChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setDateTimeChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::setTimezoneChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- // The new time zone can be retrieved through tizen.time.getLocalTimezone()
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setTimezoneChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setTimezoneChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::unsetTimezoneChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- tizen.time.unsetTimezoneChangeListener();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setTimezoneChangeListener(changedCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ tizen.time.unsetTimezoneChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setTimezoneChangeListener(changedCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var now = tizen.time.getCurrentDateTime();
- var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var now = tizen.time.getCurrentDateTime();
+var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toLocaleDateString">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
- var myDate = new Date();
- var exp_offset = myDate.getTimezoneOffset()*60;
- //offset is equals to exp_offset.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
+var myDate = new Date();
+var exp_offset = myDate.getTimezoneOffset() * 60;
+/* offset is equal to exp_offset */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::isDST">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var now = tizen.time.getCurrentDateTime();
- var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); // Becomes tomorrow, same time.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var now = tizen.time.getCurrentDateTime();
+var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); /* Becomes tomorrow, same time */
+</pre>
</div>
<div class="constructors">
<h4 id="TimeDuration::constructor">Constructors</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Assume that event1 and event2 are tizen.CalendarEvent objects.
- // Computes event1.duration - event2.duration
- var diff = event1.duration.difference(event2.duration);
- if (diff.length > 0)
- console.log("The event1 is longer than event2.");
- else if (diff.length == 0)
- console.log("The duration of two events is same.");
- else
- console.log("The event1 is shorter than the event2.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assume that event1 and event2 are tizen.CalendarEvent objects */
+/* Computes event1.duration - event2.duration */
+var diff = event1.duration.difference(event2.duration);
+if (diff.length > 0)
+ console.log("The event1 is longer than event2.");
+else if (diff.length == 0)
+ console.log("The duration of two events is same.");
+else
+ console.log("The event1 is shorter than the event2.");
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::equalsTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(60, "MINS"); // 60 minutes
- var d2 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var ret = d1.equalsTo(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(60, "MINS"); /* 60 minutes */
+var d2 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var ret = d1.equalsTo(d2); /* Returns true */
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::lessThan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var d2 = new tizen.TimeDuration(120, "MINS"); // 120 minutes
- var ret = d1.lessThan(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var d2 = new tizen.TimeDuration(120, "MINS"); /* 120 minutes */
+var ret = d1.lessThan(d2); /* Returns true */
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::greaterThan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(120, "MINS"); // 120 minutes
- var d2 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var ret = d1.greaterThan(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(120, "MINS"); /* 120 minutes */
+var d2 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var ret = d1.greaterThan(d2); /* Returns true */
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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 errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function findCB(contents) {
- console.log('The Joshua Tree :' + contents.length);
- }
+function findCB(contents)
+{
+ console.log('The Joshua Tree:' + contents.length);
+}
- tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
- </pre>
+tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
+</pre>
</div>
<div class="constructors">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> 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);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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 errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function findCB(contents) {
- console.log('The contents modified today :' + contents.length);
- }
+function findCB(contents)
+{
+ console.log('The contents modified today:' + contents.length);
+}
- tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
- </pre>
+tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
+</pre>
</div>
<div class="constructors">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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]);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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 errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function findCB(contents) {
- console.log('The Joshua Tree by U2:' + contents.length);
- }
+function findCB(contents)
+{
+ console.log('The Joshua Tree by U2:' + contents.length);
+}
- tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
- </pre>
+tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
+</pre>
</div>
<div class="constructors">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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]);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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 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 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);
- }
- }
+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);
- </pre>
+tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
+</pre>
</div>
<div class="constructors">
<h4 id="SortMode::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccess() {
- console.log("Application launched successfully");
- }
- tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccess()
+{
+ console.log("Application launched successfully");
+}
+tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Define the error callback.
- function onerror(error) {
- console.log(error.message);
- }
- function onsuccess() {
- console.log("The application has launched successfully");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Define the error callback */
+function onerror(error)
+{
+ console.log(error.message);
+}
- tizen.application.launch("targetApp0.main", onsuccess, onerror);
- </pre>
+function onsuccess()
+{
+ console.log("The application has launched successfully");
+}
+
+tizen.application.launch("targetApp0.main", onsuccess, onerror);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Turn on the silent mode
- tizen.tvaudiocontrol.setMute(true);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Turn on the silent mode */
+tizen.tvaudiocontrol.setMute(true);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Turn off the silent mode
- tizen.tvaudiocontrol.setMute(false);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Turn off the silent mode */
+tizen.tvaudiocontrol.setMute(false);
+</pre>
</div>
</dd>
<dt class="method" id="AudioControlManager::isMute">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Mute to turn off the sound
- tizen.tvaudiocontrol.setMute(true);
-
- // Check if it is mute or not
- if (tizen.tvaudiocontrol.isMute()) {
- console.log("At this moment, the sound output of this device is turned off.");
- } else {
- alert("It's not possible!");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Mute to turn off the sound */
+tizen.tvaudiocontrol.setMute(true);
+
+/* Check if it is mute */
+if (tizen.tvaudiocontrol.isMute())
+{
+ console.log("At this moment, the sound output of this device is turned off.");
+}
+else
+{
+ alert("It's not possible!");
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Checks if increasing the volume makes the silent mode turned off.
-
- // Mute to turn off the sound
- tizen.tvaudiocontrol.setMute(true);
-
- // By increasing the volume level, the mute state is changed to be off.
- tizen.tvaudiocontrol.setVolumeUp();
-
- // Check if it is mute or not
- if (tizen.tvaudiocontrol.isMute()) {
- alert("It's not possible! (API bug)");
- } else {
- console.log("setVolumeUp() turns off the silent mode.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Checks if increasing the volume makes the silent mode turned off */
+
+/* Mute to turn off the sound */
+tizen.tvaudiocontrol.setMute(true);
+
+/* By increasing the volume level, the mute state is changed to be off */
+tizen.tvaudiocontrol.setVolumeUp();
+
+/* Check if it is mute */
+if (tizen.tvaudiocontrol.isMute())
+{
+ alert("It's not possible! (API bug)");
+}
+else
+{
+ console.log("setVolumeUp() turns off the silent mode.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="AudioControlManager::setVolume">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sets the volume
- tizen.tvaudiocontrol.setVolume(10);
-
- try {
- tizen.tvaudiocontrol.setVolume(-1);
- } catch (e) {
- if (e.name === "InvalidValuesError") {
- alert("The passed value value should be in the range of 0 to 100.");
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sets the volume */
+tizen.tvaudiocontrol.setVolume(10);
+
+try
+{
+ tizen.tvaudiocontrol.setVolume(-1);
+}
+catch (e)
+{
+ if (e.name === "InvalidValuesError")
+ {
+ alert("The passed value value should be in the range of 0 to 100.");
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="AudioControlManager::setVolumeUp">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sets the volume
- tizen.tvaudiocontrol.setVolume(99);
-
- tizen.tvaudiocontrol.setVolumeUp();
- // Check if the current volume is 100 or not.
- if (tizen.tvaudiocontrol.getVolume() === 100) {
- alert("setVolumeUp() is successfully called.");
- }
-
- tizen.tvaudiocontrol.setVolumeUp();
- // Check if the volume level has been changed or not at the maximum volume level.
- if (tizen.tvaudiocontrol.getVolume() === 100) {
- alert("setVolumeUp() is successfully called.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sets the volume */
+tizen.tvaudiocontrol.setVolume(99);
+
+tizen.tvaudiocontrol.setVolumeUp();
+/* Check if the current volume is 100 */
+if (tizen.tvaudiocontrol.getVolume() === 100)
+{
+ alert("setVolumeUp() is successfully called.");
+}
+
+tizen.tvaudiocontrol.setVolumeUp();
+/* Check if the volume level has been changed at the maximum volume level */
+if (tizen.tvaudiocontrol.getVolume() === 100)
+{
+ alert("setVolumeUp() is successfully called.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="AudioControlManager::setVolumeDown">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sets the volume
- tizen.tvaudiocontrol.setVolume(1);
-
- tizen.tvaudiocontrol.setVolumeDown();
- // Check if the current volume is 0 or not.
- if (tizen.tvaudiocontrol.getVolume() === 0) {
- alert("setVolumeDown() is successfully called.");
- }
-
- tizen.tvaudiocontrol.setVolumeDown();
- // Check if the volume level has been changed or not at the minimum volume level.
- if (tizen.tvaudiocontrol.getVolume() === 0) {
- alert("setVolumeDown() is successfully called.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sets the volume */
+tizen.tvaudiocontrol.setVolume(1);
+
+tizen.tvaudiocontrol.setVolumeDown();
+/* Check if the current volume is 0 */
+if (tizen.tvaudiocontrol.getVolume() === 0)
+{
+ alert("setVolumeDown() is successfully called.");
+}
+
+tizen.tvaudiocontrol.setVolumeDown();
+/* Check if the volume level has been changed at the minimum volume level */
+if (tizen.tvaudiocontrol.getVolume() === 0)
+{
+ alert("setVolumeDown() is successfully called.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="AudioControlManager::getVolume">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var expectedVolumeLevel = 50;
-
- function onVolumeChanged(volume) {
- if (volume === expectedVolumeLevel) {
- console.log("Succeeded! The volume level has been changed to "+ volume+". ");
- } else {
- alert("Failed. The volume level has been changed to "+ volume+" . We expect 50.");
- }
- }
-
- tizen.tvaudiocontrol.setVolume(0);
-
- tizen.tvaudiocontrol.setVolumeChangeListener(onVolumeChanged);
-
- tizen.tvaudiocontrol.setVolume(expectedVolumeLevel);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var expectedVolumeLevel = 50;
+
+function onVolumeChanged(volume)
+{
+ if (volume === expectedVolumeLevel)
+ {
+ console.log("Succeeded! The volume level has been changed to " + volume + ". ");
+ }
+ else
+ {
+ alert("Failed. The volume level has been changed to " + volume + ". We expect 50.");
+ }
+}
+
+tizen.tvaudiocontrol.setVolume(0);
+
+tizen.tvaudiocontrol.setVolumeChangeListener(onVolumeChanged);
+
+tizen.tvaudiocontrol.setVolume(expectedVolumeLevel);
+</pre>
</div>
</dd>
<dt class="method" id="AudioControlManager::unsetVolumeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var expectedVolumeLevel = 50;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var expectedVolumeLevel = 50;
- function onVolumeChanged(volume) {
- alert("This function must not be called.");
- }
+function onVolumeChanged(volume)
+{
+ alert("This function must not be called.");
+}
- tizen.tvaudiocontrol.setVolume(0);
+tizen.tvaudiocontrol.setVolume(0);
- tizen.tvaudiocontrol.setVolumeChangeListener(onVolumeChanged);
- tizen.tvaudiocontrol.unsetVolumeChangeListener();
+tizen.tvaudiocontrol.setVolumeChangeListener(onVolumeChanged);
+tizen.tvaudiocontrol.unsetVolumeChangeListener();
- tizen.tvaudiocontrol.setVolume(expectedVolumeLevel);
- </pre>
+tizen.tvaudiocontrol.setVolume(expectedVolumeLevel);
+</pre>
</div>
</dd>
<dt class="method" id="AudioControlManager::getOutputMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var tuneCB = {
- onsuccess: function() {
- console.log("Tune() is successfully done. And there is a signal.");
- }
- onnosignal: function() {
- console.log("Tune() is successfully done. But there is no signal.");
- }
- };
-
- function channelCB(channels) {
- console.log("getting channels is successful. " + channels.length + " channels are retreived.");
- if (channels.length === 0 ) {
- console.log("There is no found channel.");
- return;
- }
- try {
- tizen.tvchannel.tune({major: channels[0].major}, tuneCB);
- } catch(error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- }
-
- function errorCB(error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
-
- try {
- // requests to get information about 10 channels.
- tizen.tvchannel.getChannelList(channelCB, errorCB, "ALL", 0, 10);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var tuneCB =
+{
+ onsuccess: function()
+ {
+ console.log("Tune() is successfully done. And there is a signal.");
+ }
+ onnosignal: function()
+ {
+ console.log("Tune() is successfully done. But there is no signal.");
+ }
+};
+
+function channelCB(channels)
+{
+ console.log("getting channels is successful. " + channels.length + " channels are retrieved.");
+ if (channels.length === 0)
+ {
+ console.log("There is no found channel.");
+
+ return;
+ }
+ try
+ {
+ tizen.tvchannel.tune({major: channels[0].major}, tuneCB);
+ }
+ catch (error)
+ {
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+ }
+}
+
+function errorCB(error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+
+try
+{
+ /* Requests to get information about 10 channels */
+ tizen.tvchannel.getChannelList(channelCB, errorCB, "ALL", 0, 10);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::tuneUp">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var tuneCB = {
- onsuccess: function() {
- console.log("tuneUp() is successfully done. And there is a signal.");
- }
- onnosignal: function() {
- console.log("tuneUp() is successfully done. But there is no signal.");
- }
- };
-
- try {
- tizen.tvchannel.tuneUp(tuneCB, null, "ALL");
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var tuneCB =
+{
+ onsuccess: function()
+ {
+ console.log("tuneUp() is successfully done. And there is a signal.");
+ }
+ onnosignal: function()
+ {
+ console.log("tuneUp() is successfully done. But there is no signal.");
+ }
+};
+
+try
+{
+ tizen.tvchannel.tuneUp(tuneCB, null, "ALL");
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::tuneDown">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var tuneCB = {
- onsuccess: function() {
- console.log("tuneDown() is successfully done. And there is a signal.");
- }
- onnosignal: function() {
- console.log("tuneDown() is successfully done. But there is no signal.");
- }
- };
-
- try {
- // change the channel down according to 'ALL' navigation mode.
- tizen.tvchannel.tuneDown(tuneCB);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var tuneCB =
+{
+ onsuccess: function()
+ {
+ console.log("tuneDown() is successfully done. And there is a signal.");
+ }
+ onnosignal: function()
+ {
+ console.log("tuneDown() is successfully done. But there is no signal.");
+ }
+};
+
+try
+{
+ /* Change the channel down according to 'ALL' navigation mode */
+ tizen.tvchannel.tuneDown(tuneCB);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::findChannel">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(channels) {
- console.log("findChannel() is successfully done. Totally " + channels.length + " channels are found.");
- for (var i = 0; i < channels.length; i++) {
- console.log("----- Channel [" + i + "] -----");
- console.log("Major channel = " + channels[i].major);
- console.log("Minor channel = " + channels[i].minor);
- console.log("Channel Name = " + channels[i].channelName);
- console.log("Program Number = " + channels[i].programNumber);
- // you can get other attributes provided in ChannelInfo
- }
- }
-
- try {
- tizen.tvchannel.findChannel(9, 0, successCB);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(channels)
+{
+ console.log("findChannel() is successfully done. Totally " + channels.length + " channels are found.");
+ for (var i = 0; i < channels.length; i++)
+ {
+ console.log("----- Channel [" + i + "] -----");
+ console.log("Major channel = " + channels[i].major);
+ console.log("Minor channel = " + channels[i].minor);
+ console.log("Channel Name = " + channels[i].channelName);
+ console.log("Program Number = " + channels[i].programNumber);
+ /* You can get other attributes provided in ChannelInfo */
+ }
+}
+
+try
+{
+ tizen.tvchannel.findChannel(9, 0, successCB);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::getChannelList">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(channels) {
- console.log("getChannelList() is successfully done. Totally " + channels.length + " channels are retrieved.");
- for (var i = 0; i < channels.length; i++) {
- console.log("----- Channel [" + i + "] -----");
- console.log("Major channel = " + channels[i].major);
- console.log("Minor channel = " + channels[i].minor);
- console.log("Channel Name = " + channels[i].channelName);
- console.log("Program Number = " + channels[i].programNumber);
- // you can get other attributes provided in ChannelInfo
- }
- }
-
- try {
- // gets 10 channel information among all channels
- tizen.tvchannel.getChannelList(successCB, null, "ALL", 0, 10);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(channels)
+{
+ console.log("getChannelList() is successfully done. Totally " + channels.length + " channels are retrieved.");
+ for (var i = 0; i < channels.length; i++)
+ {
+ console.log("----- Channel [" + i + "] -----");
+ console.log("Major channel = " + channels[i].major);
+ console.log("Minor channel = " + channels[i].minor);
+ console.log("Channel Name = " + channels[i].channelName);
+ console.log("Program Number = " + channels[i].programNumber);
+ /* You can get other attributes provided in ChannelInfo */
+ }
+}
+
+try
+{
+ /* Gets 10 channel information among all channels */
+ tizen.tvchannel.getChannelList(successCB, null, "ALL", 0, 10);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(channels) {
- console.log("getChannelList() is successfully done. Totally " + channels.length + " channels are retrieved.");
- for (var i = 0; i < channels.length; i++) {
- console.log("----- Channel [" + i + "] -----");
- console.log("Major channel = " + channels[i].major);
- console.log("Minor channel = " + channels[i].minor);
- console.log("Channel Name = " + channels[i].channelName);
- console.log("Program Number = " + channels[i].programNumber);
- // you can get other attributes provided in ChannelInfo
- }
- }
-
- try {
- // gets one digital channel.
- tizen.tvchannel.getChannelList(successCB, null, "DIGITAL", 0, 1);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(channels)
+{
+ console.log("getChannelList() is successfully done. Totally " + channels.length + " channels are retrieved.");
+ for (var i = 0; i < channels.length; i++)
+ {
+ console.log("----- Channel [" + i + "] -----");
+ console.log("Major channel = " + channels[i].major);
+ console.log("Minor channel = " + channels[i].minor);
+ console.log("Channel Name = " + channels[i].channelName);
+ console.log("Program Number = " + channels[i].programNumber);
+ /* You can get other attributes provided in ChannelInfo */
+ }
+}
+
+try
+{
+ /* Gets one digital channel */
+ tizen.tvchannel.getChannelList(successCB, null, "DIGITAL", 0, 1);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::getCurrentChannel">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var channel = tizen.tvchannel.getCurrentChannel();
- console.log("The current channel name is " + channel.channelName);
- console.log("The current channel's major number is " + channel.major);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var channel = tizen.tvchannel.getCurrentChannel();
+ console.log("The current channel name is " + channel.channelName);
+ console.log("The current channel's major number is " + channel.major);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::getProgramList">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function programListCB(programInfos) {
- console.log("getting all available programs is successfully retrieved.");
- for (var i = 0; i < programInfos.length; i++) {
- console.log("--------------- Program " + i + " ---------------");
- console.log("title = " + programInfos[i].title);
- console.log("duration = " + programInfos[i].duration);
- // you can get other attributes in the retrieved ProgramInfo objects.
- }
- }
-
- try {
- var channel = tizen.tvchannel.getCurrentChannel();
- // Get all available program information
- tizen.tvchannel.getProgramList(channel, tizen.time.getCurrentDateTime(), programListCB);
- } catch (error) {
- console.log(error.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function programListCB(programInfos)
+{
+ console.log("getting all available programs is successfully retrieved.");
+ for (var i = 0; i < programInfos.length; i++)
+ {
+ console.log("--------------- Program " + i + " ---------------");
+ console.log("title = " + programInfos[i].title);
+ console.log("duration = " + programInfos[i].duration);
+ /* You can get other attributes in the retrieved ProgramInfo objects */
+ }
+}
+
+try
+{
+ var channel = tizen.tvchannel.getCurrentChannel();
+ /* Get all available program information */
+ tizen.tvchannel.getProgramList(channel, tizen.time.getCurrentDateTime(), programListCB);
+}
+catch (error)
+{
+ console.log(error.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::getCurrentProgram">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var program = tizen.tvchannel.getCurrentProgram();
- console.log("The current program is titled " + program.title);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var program = tizen.tvchannel.getCurrentProgram();
+ console.log("The current program is titled " + program.title);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::addChannelChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function channelChangeCB(channelInfo, type) {
- console.log("Switched to the new channel (major = " + channelInfo.major + ", minor = " + channelInfo.minor + ", channel name = " + channelInfo.channelName);
- }
-
- try {
- var channelListenerID = tizen.tvchannel.addChannelChangeListener(channelChangeCB);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function channelChangeCB(channelInfo, type)
+{
+ console.log("Switched to the new channel (major = " + channelInfo.major + ", minor = " + channelInfo.minor +
+ ", channel name = " + channelInfo.channelName);
+}
+
+try
+{
+ var channelListenerID = tizen.tvchannel.addChannelChangeListener(channelChangeCB);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::removeChannelChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function signalStateChangeCB(state) {
- console.log("Signal state changed to: " + state);
- }
-
- try {
- var signalStateChangeListenerID = tizen.tvchannel.addSignalStateChangeListener(signalStateChangeCB);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function signalStateChangeCB(state)
+{
+ console.log("Signal state changed to: " + state);
+}
+
+try
+{
+ var signalStateChangeListenerID = tizen.tvchannel.addSignalStateChangeListener(signalStateChangeCB);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::removeSignalStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var favorites = tizen.tvchannel.getFavorites();
- for (var i = 0; i < favorites.length; ++i) {
- console.log("Favorite id: " + favorites[i].id);
- }
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var favorites = tizen.tvchannel.getFavorites();
+ for (var i = 0; i < favorites.length; ++i)
+ {
+ console.log("Favorite id: " + favorites[i].id);
+ }
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ChannelManager::getBroadcastStandard">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var res = tizen.tvchannel.getBroadcastStandard();
- console.log("Video standard: " + res);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var res = tizen.tvchannel.getBroadcastStandard();
+console.log("Video standard: " + res);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var favorites = tizen.tvchannel.getFavorites();
- var channel = tizen.tvchannel.getCurrentChannel();
- favorites[0].addChannel(channel, function() {
- console.log("Channel added");
- }, function(error) {
- console.log("Error callback: name = "+ error.name + ", Error message = " + error.message);
- });
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var favorites = tizen.tvchannel.getFavorites();
+ var channel = tizen.tvchannel.getCurrentChannel();
+ favorites[0].addChannel(channel, function()
+ {
+ console.log("Channel added");
+ }, function(error)
+ {
+ console.log("Error callback: name = " + error.name + ", Error message = " + error.message);
+ });
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FavoriteList::removeChannel">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var favorites = tizen.tvchannel.getFavorites();
- var channel = tizen.tvchannel.getCurrentChannel();
- favorites[0].removeChannel(channel, function() {
- console.log("Channel removed");
- }, function(error) {
- console.log("Error callback: name = "+ error.name + ", Error message = " + error.message);
- });
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var favorites = tizen.tvchannel.getFavorites();
+ var channel = tizen.tvchannel.getCurrentChannel();
+ favorites[0].removeChannel(channel, function()
+ {
+ console.log("Channel removed");
+ }, function(error)
+ {
+ console.log("Error callback: name = " + error.name + ", Error message = " + error.message);
+ });
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FavoriteList::getChannels">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(channels) {
- console.log("Totally " + channels.length + " channels are retrieved.");
- for (var i = 0; i < channels.length; i++) {
- console.log("----- Channel [" + i + "] -----");
- console.log("Major channel = " + channels[i].major);
- console.log("Minor channel = " + channels[i].minor);
- console.log("Channel Name = " + channels[i].channelName);
- console.log("Program Number = " + channels[i].programNumber);
- // you can get other attributes provided in ChannelInfo
- }
- }
-
- try {
- var favorites = tizen.tvchannel.getFavorites();
- // gets channel information for 10 channels
- favorites[0].getChannels(successCB, null, 0, 10);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(channels)
+{
+ console.log("Totally " + channels.length + " channels are retrieved.");
+ for (var i = 0; i < channels.length; i++)
+ {
+ console.log("----- Channel [" + i + "] -----");
+ console.log("Major channel = " + channels[i].major);
+ console.log("Minor channel = " + channels[i].minor);
+ console.log("Channel Name = " + channels[i].channelName);
+ console.log("Program Number = " + channels[i].programNumber);
+ /* You can get other attributes provided in ChannelInfo */
+ }
+}
+
+try
+{
+ var favorites = tizen.tvchannel.getFavorites();
+ /* Gets channel information for 10 channels */
+ favorites[0].getChannels(successCB, null, 0, 10);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var current3Dmode = tizen.tvdisplaycontrol.get3DEffectMode()
- console.log("The current 3D mode is " + current3Dmode + ".");
- } catch (error) {
- console.log(error.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var current3Dmode = tizen.tvdisplaycontrol.get3DEffectMode()
+ console.log("The current 3D mode is " + current3Dmode + ".");
+}
+catch (error)
+{
+ console.log(error.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="DisplayControlManager::is3DModeEnabled">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- if (tizen.tvdisplaycontrol.is3DModeEnabled() === "NOT_SUPPORTED") {
- console.log("The current device does not support 3D mode.");
- } else if (tizen.tvdisplaycontrol.is3DModeEnabled() === "READY") {
- console.log("The current device supports 3D mode and can display 3D contents. Maybe it is a 3D TV device or is connected with 3D display device.");
- } else {
- console.log("The current device supports 3D mode but cannot display 3D contents. It may be a 3D Blu-ray player device which is not connected with 3D display device.");
- }
- } catch (error) {
- console.log(error.name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ if (tizen.tvdisplaycontrol.is3DModeEnabled() === "NOT_SUPPORTED")
+ {
+ console.log("The current device does not support 3D mode.");
+ }
+ else if (tizen.tvdisplaycontrol.is3DModeEnabled() === "READY")
+ {
+ console.log("The current device supports 3D mode and can display 3D contents. Maybe it is a 3D TV device or is connected with 3D display device.");
+ }
+ else
+ {
+ console.log("The current device supports 3D mode but cannot display 3D contents. It may be a 3D Blu-ray player device which is not connected with 3D display device.");
+ }
+}
+catch (error)
+{
+ console.log(error.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="DisplayControlManager::getSupported3DEffectModeList">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(effects) {
- for( var i = 0; i < effects.length; ++i ) {
- console.log(effects[i] +" : this mode is supported on a device.");
- }
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(effects)
+{
+ for (var i = 0; i < effects.length; ++i)
+ {
+ console.log(effects[i] + ": this mode is supported on a device.");
+ }
+}
- function errorCB(error) {
- console.log("An error occurs when getSupported3DEffectModeList() is invoked. Error(name: " + error.name +" , message: "+ error.message +")");
- }
+function errorCB(error)
+{
+ console.log("An error occurs when getSupported3DEffectModeList() is invoked. Error(name: "
+ + error.name + " , message: " + error.message + ")");
+}
- try {
- tizen.tvdisplaycontrol.getSupported3DEffectModeList(successCB, errorCB);
- } catch (error) {
- console.log(error.name);
- }
- </pre>
+try
+{
+ tizen.tvdisplaycontrol.getSupported3DEffectModeList(successCB, errorCB);
+}
+catch (error)
+{
+ console.log(error.name);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Caption menu turned on: " + (tizen.tvinfo.getCaptionValue("CAPTION_ONOFF_KEY") === "CAPTION_ON"));
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log("Caption menu turned on: " + (tizen.tvinfo.getCaptionValue("CAPTION_ONOFF_KEY") === "CAPTION_ON"));
+</pre>
</div>
</dd>
<dt class="method" id="TVInfoManager::addCaptionValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function(value) {
- console.log("Caption menu state changed: " + value);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function(value)
+{
+ console.log("Caption menu state changed: " + value);
+});
+</pre>
</div>
</dd>
<dt class="method" id="TVInfoManager::removeCaptionValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function() {});
- tizen.tvinfo.removeCaptionValueChangeListener(id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function() {});
+tizen.tvinfo.removeCaptionValueChangeListener(id);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var i, keyCode = {}, supportedKeys;
- supportedKeys = tizen.tvinputdevice.getSupportedKeys();
- for (i = 0; i < supportedKeys.length; i++) {
- keyCode[supportedKeys[i].name] = supportedKeys[i].code;
- }
- if(keyCode.hasOwnProperty("ChannelUp")) {
- tizen.tvinputdevice.registerKey("ChannelUp");
- }
- window.addEventListener("keydown", function(keyEvent) {
- // identify the key by the numeric code from the keyEvent
- if(keyEvent.keyCode === keyCode.ChannelUp) {
- console.log("The CHANNEL UP was pressed");
- }
- });
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var i, keyCode = {}, supportedKeys;
+supportedKeys = tizen.tvinputdevice.getSupportedKeys();
+for (i = 0; i < supportedKeys.length; i++)
+{
+ keyCode[supportedKeys[i].name] = supportedKeys[i].code;
+}
+if (keyCode.hasOwnProperty("ChannelUp"))
+{
+ tizen.tvinputdevice.registerKey("ChannelUp");
+}
+window.addEventListener("keydown", function(keyEvent)
+{
+ /* Identify the key by the numeric code from the keyEvent */
+ if (keyEvent.keyCode === keyCode.ChannelUp)
+ {
+ console.log("The CHANNEL UP was pressed");
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="TVInputDeviceManager::getKey">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var keys = ["VolumeUp", "VolumeDown"], i;
- for (i = 0; i < keys.length; i++) {
- try {
- tizen.tvinputdevice.registerKey(keys[i]);
- } catch(error) {
- console.log("failed to register " + keys[i] + ": " + error);
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var keys = ["VolumeUp", "VolumeDown"], i;
+for (i = 0; i < keys.length; i++)
+{
+ try
+ {
+ tizen.tvinputdevice.registerKey(keys[i]);
+ }
+ catch (error)
+ {
+ console.log("failed to register " + keys[i] + ": " + error);
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="TVInputDeviceManager::unregisterKey">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.tvinputdevice.unregisterKey("VolumeDown");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.tvinputdevice.unregisterKey("VolumeDown");
+</pre>
</div>
</dd>
<dt class="method" id="TVInputDeviceManager::registerKeyBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function successCB() {
- console.log('Registered successfully');
- }
+function successCB()
+{
+ console.log('Registered successfully');
+}
- var keys = ["VolumeUp", "VolumeDown"];
- tizen.tvinputdevice.registerKeyBatch(keys, successCB, errorCB);
- </pre>
+var keys = ["VolumeUp", "VolumeDown"];
+tizen.tvinputdevice.registerKeyBatch(keys, successCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="TVInputDeviceManager::unregisterKeyBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function successCB()
+{
+ console.log('Unregistered successfully');
+}
- function successCB() {
- console.log('Unregistered successfully');
- }
- var keys = ["VolumeUp", "VolumeDown"];
- tizen.tvinputdevice.unregisterKeyBatch(keys, successCB, errorCB);
- </pre>
+var keys = ["VolumeUp", "VolumeDown"];
+tizen.tvinputdevice.unregisterKeyBatch(keys, successCB, errorCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(availableWindows) {
- for (var i = 0; i < availableWindows.length; i++) {
- console.log("Window ["+ i + "] = " + availableWindows[i]);
- }
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(availableWindows)
+{
+ for (var i = 0; i < availableWindows.length; i++)
+ {
+ console.log("Window [" + i + "] = " + availableWindows[i]);
+ }
+}
- try {
- tizen.tvwindow.getAvailableWindows(successCB);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+try
+{
+ tizen.tvwindow.getAvailableWindows(successCB);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="TVWindowManager::setSource">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var connectedVideoSources;
- function successCB(source, type) {
- console.log("setSource() is successfully done. source name = " + source.name + ", source port number = " + source.number);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var connectedVideoSources;
+function successCB(source, type)
+{
+ console.log("setSource() is successfully done. source name = " + source.name + ", source port number = " + source.number);
+}
- function errorCB(error) {
- console.log("setSource() is failed. Error name = "+ error.name + ", Error message = " + error.message);
- }
+function errorCB(error)
+{
+ console.log("setSource() is failed. Error name = " + error.name + ", Error message = " + error.message);
+}
- function systemInfoSuccessCB(videoSource) {
- connectedVideoSources = videoSource.connected;
- for (var i = 0; i < connectedVideoSources.length; i++) {
- console.log("--------------- Source " + i + " ---------------");
- console.log("type = " + connectedVideoSources[i].type);
- console.log("number = " + connectedVideoSources[i].number);
- if (connectedVideoSources[i].type === "HDMI") {
- // set HDMI as input source of the TV window
- tizen.tvwindow.setSource(connectedVideoSources[i], successCB, errorCB);
- break;
- }
- }
- }
+function systemInfoSuccessCB(videoSource)
+{
+ connectedVideoSources = videoSource.connected;
+ for (var i = 0; i < connectedVideoSources.length; i++)
+ {
+ console.log("--------------- Source " + i + " ---------------");
+ console.log("type = " + connectedVideoSources[i].type);
+ console.log("number = " + connectedVideoSources[i].number);
+ if (connectedVideoSources[i].type === "HDMI")
+ {
+ /* Set HDMI as input source of the TV window */
+ tizen.tvwindow.setSource(connectedVideoSources[i], successCB, errorCB);
+ break;
+ }
+ }
+}
- function systemInfoErrorCB(error) {
- console.log("getPropertyValue(VIDEOSOURCE) is failed. Error name = "+ error.name + ", Error message = " + error.message);
- }
+function systemInfoErrorCB(error)
+{
+ console.log("getPropertyValue(VIDEOSOURCE) is failed. Error name = " + error.name + ", Error message = " + error.message);
+}
- try {
- tizen.systeminfo.getPropertyValue("VIDEOSOURCE", systemInfoSuccessCB, systemInfoErrorCB);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+try
+{
+ tizen.systeminfo.getPropertyValue("VIDEOSOURCE", systemInfoSuccessCB, systemInfoErrorCB);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="TVWindowManager::getSource">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var source = tizen.tvwindow.getSource();
- console.log("type = " + source.type);
- console.log("number = " + source.number);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var source = tizen.tvwindow.getSource();
+ console.log("type = " + source.type);
+ console.log("number = " + source.number);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="TVWindowManager::show">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(windowRect, type) {
- // You will get exactly what you put as rectangle argument of show() through windowRect.
- // expected result : ["0", "0px", "50%", "540px"]
- console.log("Rectangle : [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(windowRect, type)
+{
+ /* You will get exactly what you put as rectangle argument of show() through windowRect */
+ /* Expected result: ["0", "0px", "50%", "540px"] */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+}
- try {
- tizen.tvwindow.show(successCB, null, ["0", "0px", "50%", "540px"], "MAIN");
- } catch(error) {
- console.log("error: " + error.name);
- }
- </pre>
+try
+{
+ tizen.tvwindow.show(successCB, null, ["0", "0px", "50%", "540px"], "MAIN");
+}
+catch (error)
+{
+ console.log("error: " + error.name);
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(windowRect, type) {
- // expected result : ["0", "0", "50%", "50%"]
- console.log("Rectangle : [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(windowRect, type)
+{
+ /* Expected result: ["0", "0", "50%", "50%"] */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+}
- try {
- tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"], "MAIN");
- } catch(error) {
- console.log("error: " + error.name);
- }
- </pre>
+try
+{
+ tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"], "MAIN");
+}
+catch (error)
+{
+ console.log("error: " + error.name);
+}
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(windowRect, type) {
- // expected result : ["10.5%", "10%", "900", "500px"]
- console.log("Rectangle : [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(windowRect, type)
+{
+ /* Expected result: ["10.5%", "10%", "900", "500px"] */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+}
- try {
- tizen.tvwindow.show(successCB, null, ["10.5%", "10%", "900", "500px"]);
- } catch(error) {
- console.log("error: " + error.name);
- }
- </pre>
+try
+{
+ tizen.tvwindow.show(successCB, null, ["10.5%", "10%", "900", "500px"]);
+}
+catch (error)
+{
+ console.log("error: " + error.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="TVWindowManager::hide">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function rectangleCB(windowRect, type) {
- // You call getRect() without specifying a unit, it expresses the area information with pixel unit.
- // expected result : ["0px", "0px", "960px", "540px"] if the screen resolution of a device is 1920 x 1080.
- console.log("Rectangle : [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function rectangleCB(windowRect, type)
+{
+ /* You call getRect() without specifying a unit, it expresses the area information with pixel unit */
+ /* Expected result: ["0px", "0px", "960px", "540px"] if the screen resolution of a device is 1920 x 1080 */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+}
- function successCB(windowRect, type) {
- // You will get exactly what you put as rectangle argument through windowRect.
- // expected result : ["0", "0", "50%", "50%"]
- console.log("Rectangle : [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
- tizen.tvwindow.getRect(rectangleCB);
- }
+function successCB(windowRect, type)
+{
+ /* You will get exactly what you put as rectangle argument through windowRect */
+ /* Expected result: ["0", "0", "50%", "50%"] */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+ tizen.tvwindow.getRect(rectangleCB);
+}
- try {
- tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"]);
- } catch(error) {
- console.log("error: " + error.name);
- }
- </pre>
+try
+{
+ tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"]);
+}
+catch (error)
+{
+ console.log("error: " + error.name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="TVWindowManager::getVideoResolution">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var res = tizen.tvwindow.getVideoResolution();
- console.log("Video resolution: " + res.width + "x" + res.height + " pixels");
- console.log("Frequency: " + res.frequency +"Hz");
- if (res.aspectRatio === "ASPECT_RATIO_16x9") {
- console.log("Widescreen on");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var res = tizen.tvwindow.getVideoResolution();
+console.log("Video resolution: " + res.width + "x" + res.height + " pixels");
+console.log("Frequency: " + res.frequency +"Hz");
+if (res.aspectRatio === "ASPECT_RATIO_16x9")
+{
+ console.log("Widescreen on");
+}
+</pre>
</div>
</dd>
<dt class="method" id="TVWindowManager::addVideoResolutionChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function change(res, type) {
- console.log("Switched to new resolution: " + res.width + "x" + res.height);
- console.log("New frequency: " + res.frequency);
- if (res.aspectRatio === "ASPECT_RATIO_16x9") {
- console.log("Widescreen is now turned on");
- }
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function change(res, type)
+{
+ console.log("Switched to new resolution: " + res.width + "x" + res.height);
+ console.log("New frequency: " + res.frequency);
+ if (res.aspectRatio === "ASPECT_RATIO_16x9")
+ {
+ console.log("Widescreen is now turned on");
+ }
+}
- try {
- var watch = tizen.tvwindow.addVideoResolutionChangeListener(change);
- } catch (error) {
- console.log("Error name = "+ error.name + ", Error message = " + error.message);
- }
- </pre>
+try
+{
+ var watch = tizen.tvwindow.addVideoResolutionChangeListener(change);
+}
+catch (error)
+{
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="TVWindowManager::removeVideoResolutionChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCallback() {
- console.log("The requested user agent string has just been set successfully.");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCallback()
+{
+ console.log("The requested user agent string has just been set successfully.");
+}
- tizen.websetting.setUserAgentString("the new user agent string to set", successCallback);
- </pre>
+tizen.websetting.setUserAgentString("the new user agent string to set", successCallback);
+</pre>
</div>
</dd>
<dt class="method" id="WebSettingManager::removeAllCookies">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCallback() {
- console.log("The cookies saved for your application have just been removed.");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCallback()
+{
+ console.log("The cookies saved for your application have just been removed.");
+}
- tizen.websetting.removeAllCookies(successCallback);
- </pre>
+tizen.websetting.removeAllCookies(successCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Triggers an alarm on a given date/time
- var alarm = new tizen.AlarmAbsolute(new Date(2014, 10, 4, 8, 0));
- var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
- tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
- console.log("Alarm added with id: " + alarm.id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Triggers an alarm on a given date/time */
+var alarm = new tizen.AlarmAbsolute(new Date(2014, 10, 4, 8, 0));
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
+tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
+console.log("Alarm added with id: " + alarm.id);
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alarms = tizen.alarm.getAll();
-
- // Removes the first alarm
- if (alarms.length > 0) {
- try {
- tizen.alarm.remove(alarms[0].id);
- console.log("Successfully removed the first alarm.");
- } catch(error) {
- console.log("Failed to remove the first alarm.");
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alarms = tizen.alarm.getAll();
+
+/* Removes the first alarm */
+if (alarms.length > 0)
+{
+ try
+ {
+ tizen.alarm.remove(alarms[0].id);
+ console.log("Successfully removed the first alarm.");
+ }
+ catch (error)
+ {
+ console.log("Failed to remove the first alarm.");
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::removeAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.alarm.removeAll();
- console.log("remove all registered alarms in the storage.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.alarm.removeAll();
+console.log("remove all registered alarms in the storage.");
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sets an alarm
- var date = new Date();
- date.setHours(date.getHours()+1);
- var abs_alarm = new tizen.AlarmAbsolute(date);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sets an alarm */
+var date = new Date();
+date.setHours(date.getHours() + 1);
+var abs_alarm = new tizen.AlarmAbsolute(date);
- // Adds an alarm
- tizen.alarm.add(abs_alarm, tizen.application.getCurrentApplication().appInfo.id);
+/* Adds an alarm */
+tizen.alarm.add(abs_alarm, tizen.application.getCurrentApplication().appInfo.id);
- // Gets an alarm
- var alarm = tizen.alarm.get(abs_alarm.id);
- console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
- </pre>
+/* Gets an alarm */
+var alarm = tizen.alarm.get(abs_alarm.id);
+console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
+</pre>
</div>
</dd>
<dt class="method" id="AlarmManager::getAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alarms = tizen.alarm.getAll();
- console.log(alarms.length + " alarms present in the storage.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alarms = tizen.alarm.getAll();
+console.log(alarms.length + " alarms present in the storage.");
+</pre>
</div>
</dd>
</dl>
If <em>period</em> is provided, it will be adjusted by the operating system, however this value will not be lower than 600 seconds.
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm in 3 hours from now
- var alarm1 = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
- tizen.alarm.add(alarm1, appId);
+/* Sets an alarm in 3 hours from now */
+var alarm1 = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
+tizen.alarm.add(alarm1, appId);
- // Sets an alarm in one hour, recurring after every 10 minutes
- var alarm2 = new tizen.AlarmRelative(tizen.alarm.PERIOD_HOUR, 10 * tizen.alarm.PERIOD_MINUTE);
- tizen.alarm.add(alarm2, appId);
- </pre>
+/* Sets an alarm in one hour, recurring after every 10 minutes */
+var alarm2 = new tizen.AlarmRelative(tizen.alarm.PERIOD_HOUR, 10 * tizen.alarm.PERIOD_MINUTE);
+tizen.alarm.add(alarm2, appId);
+</pre>
</div>
<div class="constructors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm in 3 hours from now
- var alarm = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
- tizen.alarm.add(alarm, appId);
+/* Sets an alarm in 3 hours from now */
+var alarm = new tizen.AlarmRelative(3 * tizen.alarm.PERIOD_HOUR);
+tizen.alarm.add(alarm, appId);
- var sec = alarm.getRemainingSeconds();
- console.log("remaining time is " + sec);
- </pre>
+var sec = alarm.getRemainingSeconds();
+console.log("remaining time is " + sec);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
- // Sets an alarm on January 1st 2014 08:00
- var date = new Date(2014, 0, 1, 8, 0);
- var alarm1 = new tizen.AlarmAbsolute(date);
- tizen.alarm.add(alarm1, appId);
+/* Sets an alarm on January 1st 2014 08:00 */
+var date = new Date(2014, 0, 1, 8, 0);
+var alarm1 = new tizen.AlarmAbsolute(date);
+tizen.alarm.add(alarm1, appId);
- // Sets an alarm on January 1st 2014 08:00, repeating every 2 days
- var alarm2 = new tizen.AlarmAbsolute(date, 2 * tizen.alarm.PERIOD_DAY);
- tizen.alarm.add(alarm2, appId);
+/* Sets an alarm on January 1st 2014 08:00, repeating every 2 days */
+var alarm2 = new tizen.AlarmAbsolute(date, 2 * tizen.alarm.PERIOD_DAY);
+tizen.alarm.add(alarm2, appId);
- // Sets an alarm occurring on every Saturday and Sunday, at 08:00, starting from January 1st 2014
- var alarm3 = new tizen.AlarmAbsolute(date, ["SA", "SU"]);
- tizen.alarm.add(alarm3, appId);
- </pre>
+/* Sets an alarm occurring on every Saturday and Sunday, at 08:00, starting from January 1st 2014 */
+var alarm3 = new tizen.AlarmAbsolute(date, ["SA", "SU"]);
+tizen.alarm.add(alarm3, appId);
+</pre>
</div>
<div class="constructors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
-
- // Sets an alarm on January 1st 2014 08:00
- var date = new Date(2014, 0, 1, 8, 0);
- var alarm1 = new tizen.AlarmAbsolute(date);
- tizen.alarm.add(alarm1, appId);
-
- var date = alarm1.getNextScheduledDate();
- console.log("next scheduled time is " + date);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current application ID */
+var appId = tizen.application.getCurrentApplication().appInfo.id;
+
+/* Sets an alarm on January 1st 2014 08:00 */
+var date = new Date(2014, 0, 1, 8, 0);
+var alarm1 = new tizen.AlarmAbsolute(date);
+tizen.alarm.add(alarm1, appId);
+
+var date = alarm1.getNextScheduledDate();
+console.log("next scheduled time is " + date);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
- console.log("Current application's app id is " + app.appInfo.id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+console.log("Current application's app id is " + app.appInfo.id);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::kill">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onKillSuccess() {
- console.log("Application terminated successfully");
- }
-
- function onRunningAppsContext(contexts) {
- // let's assume that the application "targetApp0.main" has been installed.
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++) {
- if (contexts[i].appId == targetId) {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
- }
-
- tizen.application.getAppsContext(onRunningAppsContext);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onKillSuccess()
+{
+ console.log("Application terminated successfully");
+}
+
+function onRunningAppsContext(contexts)
+{
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
+}
+
+tizen.application.getAppsContext(onRunningAppsContext);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::launch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess() {
- console.log("The application has launched successfully");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess()
+{
+ console.log("The application has launched successfully");
+}
- // let's assume that application "targetApp0.main" has been installed
- tizen.application.launch("targetApp0.main", onsuccess);
- </pre>
+/* Let's assume that application "targetApp0.main" has been installed */
+tizen.application.launch("targetApp0.main", onsuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::launchAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- tizen.application.launchAppControl(
- appControl,
- null,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+var appControlReplyCallback =
+{
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+}
+
+tizen.application.launchAppControl(appControl, null,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::findAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- function successCB(appInfos, appControl)
- {
- // appControl is same object with the value passed as first parameter to findAppControl()
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; // select first app's id
-
- tizen.application.launchAppControl(
- appControl,
- appId,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- }
-
- tizen.application.findAppControl(appControl, successCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+function successCB(appInfos, appControl)
+{
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+}
+
+tizen.application.findAppControl(appControl, successCB);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppsContext">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onRunningAppsContext(contexts) {
- for (var i = 0; i < contexts.length; i++)
- console.log("ID : " + contexts[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onRunningAppsContext(contexts)
+{
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
+}
- tizen.application.getAppsContext(onRunningAppsContext);
- </pre>
+tizen.application.getAppsContext(onRunningAppsContext);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppContext">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appContext = tizen.application.getAppContext(null);
- console.log("Application context retrieved for app " + appContext.appId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appContext = tizen.application.getAppContext(null);
+console.log("Application context retrieved for app " + appContext.appId);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppsInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledApps(applications) {
- for (var i = 0; i < applications.length; i++)
- console.log("ID : " + applications[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledApps(applications)
+{
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
+}
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appInfo = tizen.application.getAppInfo(null);
- console.log("Current application name : " + appInfo.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appInfo = tizen.application.getAppInfo(null);
+console.log("Current application name: " + appInfo.name);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppCerts">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appCerts = tizen.application.getAppCerts(null);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appCerts = tizen.application.getAppCerts(null);
- for (var i = 0; i < appCerts.length; i++) {
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
- }
- </pre>
+for (var i = 0; i < appCerts.length; i++)
+{
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
+}
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppSharedURI">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var sharedDir = tizen.application.getAppSharedURI(null);
- console.log("shared directory : " + sharedDir);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var sharedDir = tizen.application.getAppSharedURI(null);
+console.log("shared directory: " + sharedDir);
+</pre>
</div>
</dd>
<dt class="method" id="ApplicationManager::getAppMetaData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var metaDataArray = tizen.application.getAppMetaData(null);
- console.log("size of metadata : " + metaDataArray.length);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var metaDataArray = tizen.application.getAppMetaData(null);
+console.log("size of metadata: " + metaDataArray.length);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ApplicationManager::addAppInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ApplicationManager::removeAppInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- tizen.application.removeAppInfoEventListener(watchId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+tizen.application.removeAppInfoEventListener(watchId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
- app.exit();
- </pre>
+app.exit();
+</pre>
</div>
</dd>
<dt class="method" id="Application::hide">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
- app.hide();
- </pre>
+app.hide();
+</pre>
</div>
</dd>
<dt class="method" id="Application::getRequestedAppControl">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
- }
- </pre>
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Application::addEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- if (appId) {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data) {
- console.log("Data: " + JSON.stringify(data));
- // do something
- });
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="Application::removeEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- if (appId) {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data) {
- if (watchId) {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
<dt class="method" id="Application::broadcastEvent">
</p>
<div class="description">
<p>
-An application can listen to events from other applications. However, it can only broadcast it's own events. Therefore, the <var>appId</var> attribute of the <a href="#EventInfo">EventInfo</a> dictionary must be the identifier of the application which calls this method.
+An application can listen to events from other applications. However, it can only broadcast its own events. Therefore, the <var>appId</var> attribute of the <a href="#EventInfo">EventInfo</a> dictionary must be the identifier of the application which calls this method.
</p>
</div>
<div class="parameters">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myCustomData = {
- foo: 'bar'
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myCustomData =
+{
+ foo: 'bar'
+};
- var app = tizen.application.getCurrentApplication();
+var app = tizen.application.getCurrentApplication();
- app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
- </pre>
+app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
+</pre>
</div>
</dd>
<dt class="method" id="Application::broadcastTrustedEvent">
</p>
<div class="description">
<p>
-An application can listen to events from other applications. However, it can only broadcast it's own events. Therefore, the <var>appId</var> attribute of the <a href="#EventInfo">EventInfo</a> dictionary must be the identifier of the application which calls this method.
+An application can listen to events from other applications. However, it can only broadcast its own events. Therefore, the <var>appId</var> attribute of the <a href="#EventInfo">EventInfo</a> dictionary must be the identifier of the application which calls this method.
</p>
</div>
<div class="parameters">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myTrustedCustomData = {
- foo: 'bar'
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myTrustedCustomData =
+{
+ foo: 'bar'
+};
- var app = tizen.application.getCurrentApplication();
+var app = tizen.application.getCurrentApplication();
- app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
- </pre>
+app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
+</pre>
</div>
</dd>
</dl>
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
+</pre>
</div>
<div class="constructors">
<h4 id="ApplicationControlData::constructor">Constructors</h4>
2.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl =
- new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/view",
- null,
- "image/jpeg",
- null,
- [new tizen.ApplicationControlData("images",
- [imagedata1, imagedata2])] );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+</pre>
</div>
<div class="constructors">
<h4 id="ApplicationControl::constructor">Constructors</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick") {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="RequestedApplicationControl::replyFailure">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
- if (reqAppControl) {
- console.log("Requester AppID : " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick") {
- reqAppControl.replyFailure();
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+if (reqAppControl)
+{
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
+}
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledApps(applications) {
- for (var i = 0; i < applications.length; i++)
- console.log("ID : " + applications[i].id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledApps(applications)
+{
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
+}
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- // FindAppControlSuccessCallback instance
- function successCB(appInfos, appControl)
- {
- // appControl is same object with the value passed as first parameter to findAppControl()
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; // select first app's id
-
- tizen.application.launchAppControl(
- appControl,
- appId,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- }
-
- tizen.application.findAppControl(appControl, successCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+/* FindAppControlSuccessCallback instance */
+function successCB(appInfos, appControl)
+{
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+}
+
+tizen.application.findAppControl(appControl, successCB);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/pick",
- null,
- "image/jpeg",
- null);
-
- // ApplicationControlDataArrayReplyCallback instance
- var appControlReplyCallback = {
- // callee sent a reply
- onsuccess: function(data) {
- for (var i = 0; i < data.length; i++) {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected") {
- console.log('Selected image is ' + data[i].value[0]);
- }
- }
- },
- // callee returned failure
- onfailure: function() {
- console.log('The launch application control failed');
- }
- }
-
- tizen.application.launchAppControl(
- appControl,
- null,
- function() {console.log("launch application control succeed"); },
- function(e) {console.log("launch application control failed. reason: " + e.message); },
- appControlReplyCallback );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
+ null, "image/jpeg", null);
+
+/* ApplicationControlDataArrayReplyCallback instance */
+var appControlReplyCallback =
+{
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+}
+
+tizen.application.launchAppControl(appControl, null,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var appEventCallback = {
- oninstalled: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo) {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid) {
- console.log('The application ' + appid + ' is uninstalled');
- }
- };
- var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var appEventCallback =
+{
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
+};
+var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var app = tizen.application.getCurrentApplication();
-
- // for user events: sender's application ID and event name must be provided by using a dictionary
- // Let's assume that at least two applications are installed
- function onListInstalledApps(appsInfo) {
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id) {
- appId = appsInfo[0].id;
- } else if (appsInfo.length > 1) {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data) {
- console.log("Data: " + JSON.stringify(data));
- // do something
- };
-
- if (appId) {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
- }
- tizen.application.getAppsInfo(onListInstalledApps);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var app = tizen.application.getCurrentApplication();
+
+/* For user events: sender's application ID and event name must be provided by using a dictionary */
+/* Let's assume that at least two applications are installed */
+function onListInstalledApps(appsInfo)
+{
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
+}
+tizen.application.getAppsInfo(onListInstalledApps);
+</pre>
</div>
</dd>
</dl>
</div>
<div class="description">
<p>
-An application can listen to events from other applications. However, it can only broadcast it's own events. Therefore, when broadcasting an event, this dictionary member must be the identifier of the application which is broadcasting the event.
+An application can listen to events from other applications. However, it can only broadcast its own events. Therefore, when broadcasting an event, this dictionary member must be the identifier of the application which is broadcasting the event.
</p>
<p>
System events do not require an application identifier to be specified. If one is specified, the event will be interpreted as an user event.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCallback(archive) {
- console.log("Success, can now read from archive " + archive);
- }
-
- function errorCallback(error) {
- console.log(error);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCallback(archive)
+{
+ console.log("Success, can now read from archive " + archive);
+}
+
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveManager::abort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function openSuccess(archive) {
- operationId = archive.extractAll("downloads/extracted");
- tizen.archive.abort(operationId);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function openSuccess(archive)
+{
+ operationId = archive.extractAll("downloads/extracted");
+ tizen.archive.abort(operationId);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function successCallback() {
- console.log("done");
- }
-
- function progressCallback(opId, val, name) {
- console.log("opId: " + opId + " with progress val: " + val);
- }
-
- function createSuccess(archive) {
- archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
- }
-
- tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function successCallback()
+{
+ console.log("done");
+}
+
+function progressCallback(opId, val, name)
+{
+ console.log("opId: " + opId + " with progress val: " + val);
+}
+
+function createSuccess(archive)
+{
+ archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
+}
+
+tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::extractAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function successCallback() {
- console.log("done");
- }
-
- function progressCallback(opId, val, name) {
- console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
- }
-
- function openSuccess(archive) {
- archive.extractAll("music", successCallback, errorCallback, progressCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function successCallback()
+{
+ console.log("done");
+}
+
+function progressCallback(opId, val, name)
+{
+ console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
+}
+
+function openSuccess(archive)
+{
+ archive.extractAll("music", successCallback, errorCallback, progressCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::getEntries">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function getEntriesSuccess(entries) {
- console.log("Entries length: " + entries.length);
- for (var i=0; i < entries.length; i++) {
- console.log(entries[i].name);
- }
- }
-
- function openSuccess(archive) {
- archive.getEntries(getEntriesSuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function getEntriesSuccess(entries)
+{
+ console.log("Entries length: " + entries.length);
+ for (var i = 0; i < entries.length; i++)
+ {
+ console.log(entries[i].name);
+ }
+}
+
+function openSuccess(archive)
+{
+ archive.getEntries(getEntriesSuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::getEntryByName">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function getEntrySuccess(entry) {
- console.log("Entry: " + entry.name + " size: " + entry.size);
- }
-
- function openSuccess(archive) {
- archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function getEntrySuccess(entry)
+{
+ console.log("Entry: " + entry.name + " size: " + entry.size);
+}
+
+function openSuccess(archive)
+{
+ archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+</pre>
</div>
</dd>
<dt class="method" id="ArchiveFile::close">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log(error);
- }
-
- function extractSuccessCallback() {
- console.log("done");
- }
-
- function getEntrySuccess(entry) {
- entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
- }
-
- function openSuccess(archive) {
- archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error);
+}
+
+function extractSuccessCallback()
+{
+ console.log("done");
+}
+
+function getEntrySuccess(entry)
+{
+ entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
+}
+
+function openSuccess(archive)
+{
+ archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.badge.setBadgeCount("AVbg1ZHu6l.BadgeSample", 3);
- } catch(e) {
- console.log("Error Exception, error name : " + e.name + ", error message : " + e.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.badge.setBadgeCount("AVbg1ZHu6l.BadgeSample", 3);
+}
+catch (e)
+{
+ console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="BadgeManager::getBadgeCount">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var count = tizen.badge.getBadgeCount("AVbg1ZHu6l.BadgeSample");
- } catch(e) {
- console.log("Error Exception, error name : " + e.name + ", error message : " + e.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var count = tizen.badge.getBadgeCount("AVbg1ZHu6l.BadgeSample");
+}
+catch (e)
+{
+ console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="BadgeManager::addChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function watcher(appId, count) {
- console.log(appId + ' badge number were updated : ' + count);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function watcher(appId, count)
+{
+ console.log(appId + ' badge number were updated: ' + count);
+}
- // Registers to be notified when the badge number changes
- tizen.badge.addChangeListener(["AVbg1ZHu6l.BadgeSample", "BDb5tZJe47.TestSample"], watcher);
- </pre>
+/* Registers to be notified when the badge number changes */
+tizen.badge.addChangeListener(["AVbg1ZHu6l.BadgeSample", "BDb5tZJe47.TestSample"], watcher);
+</pre>
</div>
</dd>
<dt class="method" id="BadgeManager::removeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Receives badge number changes
- function watcher(appId, count) {
- console.log(appId + ' badge number were updated : ' + count);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Receives badge number changes */
+function watcher(appId, count)
+{
+ console.log(appId + ' badge number were updated: ' + count);
+}
- // Registers to be notified when the badge number changes
- tizen.badge.addChangeListener(["AVbg1ZHu6l.BadgeSample", "BDb5tZJe47.TestSample"], watcher);
+/* Registers to be notified when the badge number changes */
+tizen.badge.addChangeListener(["AVbg1ZHu6l.BadgeSample", "BDb5tZJe47.TestSample"], watcher);
- // Cancels the watch operation
- tizen.badge.removeChangeListener(["AVbg1ZHu6l.BadgeSample", "BDb5tZJe47.TestSample"]);
- </pre>
+/* Cancels the watch operation */
+tizen.badge.removeChangeListener(["AVbg1ZHu6l.BadgeSample", "BDb5tZJe47.TestSample"]);
+</pre>
</div>
</dd>
</dl>
<dl>
<pre class="webidl prettyprint">BluetoothLEServiceData(DOMString uuid, DOMString data);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a serviceData.
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a serviceData */
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+</pre>
</div>
</dl>
</div>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a serviceData.
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- service.uuid = "f236-41a4";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a serviceData */
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+service.uuid = "f236-41a4";
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEServiceData::data">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a serviceData.
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- service.data = "0x1815";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a serviceData */
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+service.data = "0x1815";
+</pre>
</div>
</li>
</ul>
<dl>
<pre class="webidl prettyprint">BluetoothLEManufacturerData(DOMString id, DOMString data);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a manufacturerData.
- var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a manufacturerData */
+var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
+</pre>
</div>
</dl>
</div>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a manufacturerData.
- var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
- manufacturer.id = "129";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a manufacturerData */
+var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
+manufacturer.id = "129";
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEManufacturerData::data">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a manufacturerData.
- var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
- manufacturer.data = "0x0059"
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a manufacturerData */
+var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
+manufacturer.data = "0x0059"
+</pre>
</div>
</li>
</ul>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
- appearance: 192, includeTxPowerLevel: false }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertData =
+{
+ includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
+ appearance: 192, includeTxPowerLevel: false
+}
+</pre>
</div>
</div>
<div class="interface" id="BluetoothLEAdvertiseData">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
- appearance: 192, includeTxPowerLevel: false }
- var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertData =
+{
+ includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
+ appearance: 192, includeTxPowerLevel: false
+}
+var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
+</pre>
</div>
<div class="constructors">
<h4 id="BluetoothLEAdvertiseData::constructor">Constructors</h4>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.includeName = true;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.includeName = true;
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::uuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.uuids = ["180d"];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.uuids = ["180d"];
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::solicitationuuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.solicitationuuids = ["180f"];
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.solicitationuuids = ["180f"];
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::appearance">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.appearance = 192;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.appearance = 192;
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::includeTxPowerLevel">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- advertise.includeTxPowerLevel = true;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+advertise.includeTxPowerLevel = true;
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::serviceData">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- advertise.serviceData = service;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+advertise.serviceData = service;
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEAdvertiseData::manufacturerData">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var advertise = new tizen.BluetoothLEAdvertiseData();
- var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
- advertise.manufacturerData = manufacture;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var advertise = new tizen.BluetoothLEAdvertiseData();
+var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
+advertise.manufacturerData = manufacture;
+</pre>
</div>
</li>
</ul>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(tizen.bluetooth.deviceMajor);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(tizen.bluetooth.deviceMajor);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothManager::deviceMinor">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(tizen.bluetooth.deviceMinor);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(tizen.bluetooth.deviceMinor);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothManager::deviceService">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(tizen.bluetooth.deviceService);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(tizen.bluetooth.deviceService);
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter = tizen.bluetooth.getDefaultAdapter() ;
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter = tizen.bluetooth.getDefaultAdapter();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothManager::getLEAdapter">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter = tizen.bluetooth.getLEAdapter();
- } catch (err) {
- console.log(err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter = tizen.bluetooth.getLEAdapter();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Access adapter name
- var adapter = tizen.bluetooth.getDefaultAdapter();
- console.log ("Bluetooth adapter name: " + adapter.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Access adapter name */
+var adapter = tizen.bluetooth.getDefaultAdapter();
+console.log("Bluetooth adapter name: " + adapter.name);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothAdapter::address">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- console.log("Bluetooth device address: " + adapter.address);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+console.log("Bluetooth device address: " + adapter.address);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothAdapter::powered">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothAdapter::visible">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Queries the current visible state
- var adapter = tizen.bluetooth.getDefaultAdapter();
- console.log ("Bluetooth Visibility: " + (adapter.visible ? "On" : "Off"));
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Queries the current visible state */
+var adapter = tizen.bluetooth.getDefaultAdapter();
+console.log("Bluetooth Visibility: " + (adapter.visible ? "On" : "Off"));
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
-
- function changeName(newName) {
- if (adapter.name != newName) {
- // initiate change name
- adapter.setName(newName, function() {
- console.log("Adapter name changed to " + adapter.name);
- },
- function(e) {
- console.log("Failed to change name: " + e.message);
- });
- }
- }
- if (bt_always_on === false) {
- changeName("myDevice");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
+
+function changeName(newName)
+{
+ if (adapter.name != newName)
+ {
+ /* Initiate change name */
+ adapter.setName(newName, function()
+ {
+ console.log("Adapter name changed to " + adapter.name);
+ }, function(e)
+ {
+ console.log("Failed to change name: " + e.message);
+ });
+ }
+}
+if (bt_always_on === false)
+{
+ changeName("myDevice");
+}
+</pre>
</div>
</dd>
<dt class="deprecated method" id="BluetoothAdapter::setPowered">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function powerOn() {
- // If adapter is not powered on
- if (!adapter.powered) {
- // Initiates power on
- adapter.setPowered(true, function() {
- console.log("Bluetooth powered on success.");
- },
- function(e) {
- console.log("Failed to power on Bluetooth: " + e.message);
- });
- }
- }
-
- function powerOff() {
- // If powered on
- if (adapter.powered) {
- // Initiates power off
- adapter.setPowered(false, function() {
- console.log("Bluetooth powered off successfully.");
- },
- function(e) {
- console.log("Failed to power off Bluetooth: " + e.message);
- });
- }
- }
-
- var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
- if (bt_always_on === true) {
- console.log("Bluetooth cannot be turn off or on because this device must be always enabled.");
- } else {
- powerOn();
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function powerOn()
+{
+ /* If adapter is not powered on */
+ if (!adapter.powered)
+ {
+ /* Initiates power on */
+ adapter.setPowered(true, function()
+ {
+ console.log("Bluetooth powered on success.");
+ }, function(e)
+ {
+ console.log("Failed to power on Bluetooth: " + e.message);
+ });
+ }
+}
+
+function powerOff()
+{
+ /* If powered on */
+ if (adapter.powered)
+ {
+ /* Initiates power off */
+ adapter.setPowered(false, function()
+ {
+ console.log("Bluetooth powered off successfully.");
+ }, function(e)
+ {
+ console.log("Failed to power off Bluetooth: " + e.message);
+ });
+ }
+}
+
+var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
+if (bt_always_on === true)
+{
+ console.log("Bluetooth cannot be turn off or on because this device must be always enabled.");
+}
+else
+{
+ powerOn();
+}
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::setChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changeListener = {
- onstatechanged: function(powered) {
- console.log ("Power state is changed into: " + powered);
- },
- onnamechanged: function(name) {
- console.log("Name is changed to: " + name);
- },
- onvisibilitychanged: function(visible) {
- console.log("Visibility is changed into: " + visible);
- }
- };
-
- var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.setChangeListener(changeListener);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changeListener =
+{
+ onstatechanged: function(powered)
+ {
+ console.log("Power state is changed into: " + powered);
+ },
+ onnamechanged: function(name)
+ {
+ console.log("Name is changed to: " + name);
+ },
+ onvisibilitychanged: function(visible)
+ {
+ console.log("Visibility is changed into: " + visible);
+ }
+};
+
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.setChangeListener(changeListener);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::unsetChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- var changeListener = {
- onstatechanged: function(powered) {
- console.log ("Power state is changed into: " + powered);
- if (!powered)
- adapter.unsetChangeListener();
- },
- onnamechanged: function(name) {
- console.log("Name is changed to: " + name);
- },
- onvisibilitychanged: function(visible) {
- console.log("Visibility is changed into: " + visible);
- }
- };
-
- adapter.setChangeListener(changeListener);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+var changeListener =
+{
+ onstatechanged: function(powered)
+ {
+ console.log("Power state is changed into: " + powered);
+ if (!powered)
+ adapter.unsetChangeListener();
+ },
+ onnamechanged: function(name)
+ {
+ console.log("Name is changed to: " + name);
+ },
+ onvisibilitychanged: function(visible)
+ {
+ console.log("Visibility is changed into: " + visible);
+ }
+};
+
+adapter.setChangeListener(changeListener);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::discoverDevices">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function startDiscovery() {
-
- var discoverDevicesSuccessCallback = {
- onstarted: function() {
- console.log ("Device discovery started...");
- },
- ondevicefound: function(device) {
- console.log("Found device - name: " + device.name + ", Address: "+ device.address);
- },
- ondevicedisappeared: function(address) {
- console.log("Device disappeared: " + address);
- },
- onfinished: function(devices) {
- console.log("Found Devices");
- for (var i = 0; i < devices.length; i++) {
- console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
- };
-
- // Starts searching for nearby devices, for about 12 sec.
- adapter.discoverDevices(discoverDevicesSuccessCallback, function(e) {
- console.log ("Failed to search devices: " + e.message + "(" + e.name + ")");
- });
- }
-
- function onSetPoweredError(e) {
- console.log ("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
- }
-
- adapter.setPowered(true, startDiscovery, onSetPoweredError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function startDiscovery()
+{
+ var discoverDevicesSuccessCallback =
+ {
+ onstarted: function()
+ {
+ console.log("Device discovery started...");
+ },
+ ondevicefound: function(device)
+ {
+ console.log("Found device - name: " + device.name + ", Address: " + device.address);
+ },
+ ondevicedisappeared: function(address)
+ {
+ console.log("Device disappeared: " + address);
+ },
+ onfinished: function(devices)
+ {
+ console.log("Found Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+ }
+ };
+
+ /* Starts searching for nearby devices, for about 12 sec */
+ adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
+ {
+ console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
+ });
+}
+
+function onSetPoweredError(e)
+{
+ console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
+}
+
+adapter.setPowered(true, startDiscovery, onSetPoweredError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::stopDiscovery">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- // Calls this method whenever user finds one of the device.
- function cancelDiscovery() {
- adapter.stopDiscovery(function() {
- console.log("Stop discovery success.");
- },
- function (e) {
- console.log("Error while stopDiscovery:" + e.message);
- });
- }
-
- function startDiscovery() {
-
- var discoverDevicesSuccessCallback = {
- onstarted: function() {
- console.log ("Device discovery started...") ;
- },
- ondevicefound: function(device) {
- console.log("Found device - name: " + device.name + ", Address: "+ device.address);
- // Shows the device to user to check if this is the device user is looking for.
- // For example, add this to list view.
-
- cancelDiscovery();
- },
- ondevicedisappeared: function(address) {
- console.log("Device disappeared: " + address);
- // Removes from list, as it is no longer valid.
- },
- onfinished: function(devices) {
- console.log("Found Devices");
- for (var i = 0; i < devices.length; i++) {
- console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
- };
-
- // Starts searching for nearby devices, for about 12 sec.
- adapter.discoverDevices(discoverDevicesSuccessCallback, function(e) {
- console.log ("Failed to search devices: " + e.message + "(" + e.name + ")");
- });
- }
-
- function onSetPoweredError(e) {
- console.log ("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
- }
-
- adapter.setPowered(true, startDiscovery, onSetPoweredError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+/* Calls this method whenever user finds one of the device */
+function cancelDiscovery()
+{
+ adapter.stopDiscovery(function()
+ {
+ console.log("Stop discovery success.");
+ }, function(e)
+ {
+ console.log("Error while stopDiscovery:" + e.message);
+ });
+}
+
+function startDiscovery()
+{
+ var discoverDevicesSuccessCallback =
+ {
+ onstarted: function()
+ {
+ console.log("Device discovery started...");
+ },
+ ondevicefound: function(device)
+ {
+ console.log("Found device - name: " + device.name + ", Address: " + device.address);
+ /* Shows the device to user to check if this is the device user is looking for */
+ /* For example, add this to list view */
+
+ cancelDiscovery();
+ },
+ ondevicedisappeared: function(address)
+ {
+ console.log("Device disappeared: " + address);
+ /* Removes from list, as it is no longer valid */
+ },
+ onfinished: function(devices)
+ {
+ console.log("Found Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+ }
+ };
+
+ /* Starts searching for nearby devices, for about 12 sec */
+ adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
+ {
+ console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
+ });
+}
+
+function onSetPoweredError(e)
+{
+ console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
+}
+
+adapter.setPowered(true, startDiscovery, onSetPoweredError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::getKnownDevices">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function onGotDevices(devices) {
- console.log("Devices");
- for (var i = 0; i < devices.length; i++) {
- console.log(" Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
-
- function onError(e) {
- console.log ("Error: " + e.message);
- }
-
- function onBluetoothsetPowered() {
- adapter.getKnownDevices(onGotDevices, onError);
- }
-
- // Turns on Bluetooth
- adapter.setPowered(true, onBluetoothsetPowered);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function onGotDevices(devices)
+{
+ console.log("Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log(" Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+}
+
+function onError(e)
+{
+ console.log("Error: " + e.message);
+}
+
+function onBluetoothsetPowered()
+{
+ adapter.getKnownDevices(onGotDevices, onError);
+}
+
+/* Turns on Bluetooth */
+adapter.setPowered(true, onBluetoothsetPowered);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::getDevice">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function gotDeviceInfo(device) {
- console.log("Device Name: " + device.name);
- console.log("Device Address: " + device.address);
- console.log("Device Class: " + device.deviceClass.major);
- console.log("Is Bonded: " + (device.isBonded ? "Yes" : "No"));
- }
-
- function onError(e) {
- console.log ("Could not get device info:" + e.message);
- }
-
- var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo, onError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function gotDeviceInfo(device)
+{
+ console.log("Device Name: " + device.name);
+ console.log("Device Address: " + device.address);
+ console.log("Device Class: " + device.deviceClass.major);
+ console.log("Is Bonded: " + (device.isBonded ? "Yes" : "No"));
+}
+
+function onError(e)
+{
+ console.log("Could not get device info:" + e.message);
+}
+
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo, onError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::createBonding">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onBondingSuccess(device) {
- console.log("Device Name:" + device.name);
- console.log("Device Address:" + device.address);
- console.log("Device Service UUIDs:" + device.uuids.join("\n"));
- }
-
- function onError(e) {
- console.log ("Could not create bonding, reason:" + e.message);
- }
-
- var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.createBonding("35:F4:59:D1:7A:03", onBondingSuccess, onError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onBondingSuccess(device)
+{
+ console.log("Device Name:" + device.name);
+ console.log("Device Address:" + device.address);
+ console.log("Device Service UUIDs:" + device.uuids.join("\n"));
+}
+
+function onError(e)
+{
+ console.log("Could not create bonding, reason:" + e.message);
+}
+
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.createBonding("35:F4:59:D1:7A:03", onBondingSuccess, onError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::destroyBonding">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function gotDevice(device) {
- if (device.isBonded) {
- // Initiates destroying bonding
- adapter.destroyBonding(device.address, function() {
- console.log("Succeeded to destroy the bond success with:" + device.address);
- },
- function(e) {
- console.log("Failed to destroy the bond with " + device.address + ", reason: " + e.message);
- });
- }
- }
-
- var deviceAddress = "35:F4:59:D1:7A:03";
- adapter.getDevice(deviceAddress, gotDevice, function(e) {
- console.log("Failed to get device info for " + deviceAddress + ", reason: " + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function gotDevice(device)
+{
+ if (device.isBonded)
+ {
+ /* Initiates destroying bonding */
+ adapter.destroyBonding(device.address, function()
+ {
+ console.log("Succeeded to destroy the bond success with:" + device.address);
+ }, function(e)
+ {
+ console.log("Failed to destroy the bond with " + device.address + ", reason: " + e.message);
+ });
+ }
+}
+
+var deviceAddress = "35:F4:59:D1:7A:03";
+adapter.getDevice(deviceAddress, gotDevice, function(e)
+{
+ console.log("Failed to get device info for " + deviceAddress + ", reason: " + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::registerRFCOMMServiceByUUID">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- // Holds currently registered service record
- var chatServiceHandler = null;
- // Holds currently open socket
- var serviceSocket = null;
-
- function chatServiceSuccessCb(recordHandler) {
- console.log("Chat service registration succeeds!");
- chatServiceHandler = recordHandler;
- recordHandler.onconnect = function(socket) {
- console.log("Client connected: " + socket.peer.name + "," + socket.peer.address);
- serviceSocket = socket;
- // Messages received from remote device
- socket.onmessage = function() {
- var data = socket.readData();
- // Handles message code goes here
-
- };
-
- socket.onclose = function() {
- console.log('The socket is closed.');
- serviceSocket = null;
- };
- };
- };
-
- function publishChatService() {
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
- // Error handler
- function(e) {
- console.log( "Could not register service record, Error: " + e.message);
- });
- }
-
- function unregisterChatService() {
- if (chatServiceHandler != null) {
- chatServiceHandler.unregister(function() {
- console.log("Chat service is unregistered");
- chatServiceHandler = null;
- }, function(e) {
- console.log("Failed to unregister service: " + e.message);
- });
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+/* Holds currently registered service record */
+var chatServiceHandler = null;
+/* Holds currently open socket */
+var serviceSocket = null;
+
+function chatServiceSuccessCb(recordHandler)
+{
+ console.log("Chat service registration succeeds!");
+ chatServiceHandler = recordHandler;
+ recordHandler.onconnect = function(socket)
+ {
+ console.log("Client connected: " + socket.peer.name + "," + socket.peer.address);
+ serviceSocket = socket;
+ /* Messages received from remote device */
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handles message code goes here */
+ };
+
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ serviceSocket = null;
+ };
+ };
+};
+
+function publishChatService()
+{
+ var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+ adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
+ /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
+}
+
+function unregisterChatService()
+{
+ if (chatServiceHandler != null)
+ {
+ chatServiceHandler.unregister(function()
+ {
+ console.log("Chat service is unregistered");
+ chatServiceHandler = null;
+ }, function(e)
+ {
+ console.log("Failed to unregister service: " + e.message);
+ });
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothAdapter::getBluetoothProfileHandler">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler;
- var healthCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.health");
-
- if (healthCapability) {
- healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- } else {
- console.log("Bluetooth Health Profile is not supported on this device.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler;
+var healthCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.health");
+
+if (healthCapability)
+{
+ healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+}
+else
+{
+ console.log("Bluetooth Health Profile is not supported on this device.");
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("[Found device] address: " + device.address);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("[Found device] address: " + device.address);
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEAdapter::stopScan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- adapter.stopScan();
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ adapter.stopScan();
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEAdapter::startAdvertise">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- var battery_svc_uuid_16 = "180f"; // the service UUID, 16-bit UUID is supported. (e.g. 180f)
- var heart_rate_svc_uuid_16 = "180d"; // the service solicitation UUID, 16-bit UUID is supported. (e.g. 180d)
- var advertiseOptions = {
- includeName: true, // Whether the device name should be included
- includeTxPowerLevel: true, // Whether the transmission power level should be included
- appearance: 192, // The external appearance of device, 192 - Generic Watch
- uuids: [battery_svc_uuid_16],
- solicitationuuids: [heart_rate_svc_uuid_16]
- };
-
- var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
- var connectable = true;
-
- adapter.startAdvertise(
- advertiseData,
- "ADVERTISE",
- function onstate(state) {
- console.log("Advertiser state: " + state);
- },
- function(e) {
- console.log("Failed to startAdvertise : " + e.message);
- },
- "LOW_LATENCY",
- connectable);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+var battery_svc_uuid_16 = "180f"; /* Service UUID, 16-bit UUID is supported (e.g. 180f) */
+var heart_rate_svc_uuid_16 = "180d"; /* Service solicitation UUID, 16-bit UUID is supported (e.g. 180d) */
+var advertiseOptions =
+{
+ includeName: true, /* Whether the device name should be included */
+ includeTxPowerLevel: true, /* Whether the transmission power level should be included */
+ appearance: 192, /* External appearance of device, 192 - Generic Watch */
+ uuids: [battery_svc_uuid_16],
+ solicitationuuids: [heart_rate_svc_uuid_16]
+};
+
+var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
+var connectable = true;
+
+adapter.startAdvertise(advertiseData, "ADVERTISE", function onstate(state)
+{
+ console.log("Advertiser state: " + state);
+}, function(e)
+{
+ console.log("Failed to startAdvertise: " + e.message);
+}, "LOW_LATENCY", connectable);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEAdapter::stopAdvertise">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- var battery_svc_uuid_16 = "180f"; // the service UUID, 16-bit UUID is supported. (e.g. 180f)
- var heart_rate_svc_uuid_16 = "180d"; // the service solicitation UUID, 16-bit UUID is supported. (e.g. 180d)
- var advertiseOptions = {
- includeName: true, // Whether the device name should be included
- includeTxPowerLevel: true, // Whether the transmission power level should be included
- appearance: 192, // The external appearance of device, 192 - Generic Watch
- uuids: [battery_svc_uuid_16],
- solicitationuuids: [heart_rate_svc_uuid_16]
- };
-
- var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
-
- adapter.startAdvertise(advertiseData, "ADVERTISE",
- function onstate(state) {
- console.log("Advertiser state: " + state);
- });
- adapter.stopAdvertise();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+var battery_svc_uuid_16 = "180f"; /* Service UUID, 16-bit UUID is supported (e.g. 180f) */
+var heart_rate_svc_uuid_16 = "180d"; /* Service solicitation UUID, 16-bit UUID is supported (e.g. 180d) */
+var advertiseOptions =
+{
+ includeName: true, /* Whether the device name should be included */
+ includeTxPowerLevel: true, /* Whether the transmission power level should be included */
+ appearance: 192, /* External appearance of device, 192 - Generic Watch */
+ uuids: [battery_svc_uuid_16],
+ solicitationuuids: [heart_rate_svc_uuid_16]
+};
+
+var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
+
+adapter.startAdvertise(advertiseData, "ADVERTISE", function onstate(state)
+{
+ console.log("Advertiser state: " + state);
+});
+adapter.stopAdvertise();
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onconnected(device) {
- console.log("Connected to device");
- var service = device.getService(device.uuids[0]);
- console.log("Service got");
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("[Found device] address: " + device.address);
- device.connect(onconnected.bind(null, device), onerror);
- });
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onconnected(device)
+{
+ console.log("Connected to device");
+ var service = device.getService(device.uuids[0]);
+ console.log("Service got");
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("[Found device] address: " + device.address);
+ device.connect(onconnected.bind(null, device), onerror);
+});
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service = device.getService(device.uuids[0]);
- console.log("Service UUID " + service.uuid);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service = device.getService(device.uuids[0]);
+console.log("Service UUID " + service.uuid);
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothGATTService::services">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service = device.getService(device.uuids[0]);
- for (var i = 0; i service.services.length; ++i) {
- console.log("Subservices UUID " + service.services[i].uuid);
- }
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service = device.getService(device.uuids[0]);
+for (var i = 0; i service.services.length; ++i)
+{
+ console.log("Subservices UUID " + service.services[i].uuid);
+}
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothGATTService::characteristics">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var service = device.getService(device.uuids[0]);
- for (var i = 0; i service.characteristics.length; ++i) {
- console.log("Subservices UUID " + service.characteristics[i].isWritable);
- }
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var service = device.getService(device.uuids[0]);
+for (var i = 0; i service.characteristics.length; ++i)
+{
+ console.log("Subservices UUID " + service.characteristics[i].isWritable);
+}
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function proccessDevice(device) {
- device.connect(onConnected, onerror);
- function onConnected() {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- characteristic.readValue(function(val) {
- console.log("Value read: " + val);
- device.disconnect();
- });
- }
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function proccessDevice(device)
+{
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ characteristic.readValue(function(val)
+ {
+ console.log("Value read: " + val);
+ device.disconnect();
+ });
+ }
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothGATTCharacteristic::writeValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function proccessDevice(device) {
- device.connect(onConnected, onerror);
- function onConnected() {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- var data = new Array(1, 2, 3, 4, 5, 6);
- characteristic.writeValue(data, function() {
- console.log("Value written");
- device.disconnect();
- }, function(e) {
- console.log("Failed to write: " + e.message);
- });
- }
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function proccessDevice(device)
+{
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var data = new Array(1, 2, 3, 4, 5, 6);
+ characteristic.writeValue(data, function()
+ {
+ console.log("Value written");
+ device.disconnect();
+ }, function(e)
+ {
+ console.log("Failed to write: " + e.message);
+ });
+ }
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothGATTCharacteristic::addValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function proccessDevice(device) {
-
- function onConnected() {
- var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- var watchID;
-
- watchID = characteristic.addValueChangeListener(function(value) {
- console.log("Characteristic value changed: " + value);
- characteristic.removeValueChangeListener(watchID);
- device.disconnect();
- });
- }
- }
-
- device.connect(onConnected);
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- adapter.stopScan();
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function proccessDevice(device)
+{
+ function onConnected()
+ {
+ var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var watchID;
+
+ watchID = characteristic.addValueChangeListener(function(value)
+ {
+ console.log("Characteristic value changed: " + value);
+ characteristic.removeValueChangeListener(watchID);
+ device.disconnect();
+ });
+ }
+ }
+
+ device.connect(onConnected);
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ adapter.stopScan();
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothGATTCharacteristic::removeValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function proccessDevice(device) {
- device.connect(onConnected, onerror);
- function onConnected() {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- var descriptor = characteristic.descriptors[0];
- descriptor.readValue(function(val) {
- console.log("Value read: " + val);
- device.disconnect();
- });
- }
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function proccessDevice(device)
+{
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var descriptor = characteristic.descriptors[0];
+ descriptor.readValue(function(val)
+ {
+ console.log("Value read: " + val);
+ device.disconnect();
+ });
+ }
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothGATTDescriptor::writeValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function proccessDevice(device) {
- device.connect(onConnected, onerror);
- function onConnected() {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0) {
- var characteristic = service.characteristics[0];
- var data = new Array(1, 2, 3, 4, 5, 6);
- var descriptor = characteristic.descriptors[0];
- descriptor.writeValue(data, function() {
- console.log("Value written");
- device.disconnect();
- }, function(e) {
- console.log("Failed to write: " + e.message);
- });
- }
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function proccessDevice(device)
+{
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var data = new Array(1, 2, 3, 4, 5, 6);
+ var descriptor = characteristic.descriptors[0];
+ descriptor.writeValue(data, function()
+ {
+ console.log("Value written");
+ device.disconnect();
+ }, function(e)
+ {
+ console.log("Failed to write: " + e.message);
+ });
+ }
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
+});
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Device Name: " + device.name);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Device Name: " + device.name);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::address">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Device Address: " + device.address);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Device Address: " + device.address);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::deviceClass">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Device Major Class: " + device.deviceClass.major);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Device Major Class: " + device.deviceClass.major);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::isBonded">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::isTrusted">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::isConnected">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothDevice::uuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.getDevice("11:22:33:44:55:66", function(device) {
- var uuids = device.uuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++) {
- services += uuids[i] + "\n";
- }
- console.log ("Services found: " + services);
- if (uuids.indexOf(CHAT_SERVICE_UUID) != -1) {
- // Connects to service
- device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket) {
- //
- // Connected to service, handle socket
- //
- }, function (e) {
- console.log("Could not connect to chat service !!!. Error: " + e.message);
- });
- }
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+adapter.getDevice("11:22:33:44:55:66", function(device)
+{
+ var uuids = device.uuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Services found: " + services);
+ if (uuids.indexOf(CHAT_SERVICE_UUID) != -1)
+ {
+ /* Connects to service */
+ device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket)
+ {
+ /* Connected to service, handle socket */
+ }, function(e)
+ {
+ console.log("Could not connect to chat service !!!. Error: " + e.message);
+ });
+ }
+});
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var clientSocket = null;
-
- // Calls a method that is invoked when user wants to send a message to a remote device.
- function sendMessage(msg) {
- // Validates socket state, if everything is ok.
- if (clientSocket != null && clientSocket.state == "OPEN") {
- // Sends the message.
- clientSocket.writeData(msg);
- }
- }
-
- // Calls a method that is invoked when a socket is open.
- function onSocketConnected(socket) {
- clientSocket = socket;
- console.log("Opening a socket successfully!!!");
- socket.onmessage = function () {
- var data = socket.readData();
- var recvmsg = "";
- for (var i = 0; i < data.length; i++)
- {
- recvmsg += String.fromCharCode(data[i]);
- }
- console.log("server msg >> " + recvmsg);
- };
-
- socket.onclose = function() {
- console.log("socket disconnected.");
- };
- }
-
- function onDeviceReady(device) {
- // Validates device and service uuid
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1) {
- // Opens socket
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e) {
- console.log ("Error connecting to service. Reason: " + e.message);
- });
- }
- else {
- console.log ("Chat service is not supported by this device");
- }
- }
-
- function onSetPowered() {
- // Gets the BluetoothDevice object.
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) { console.log("Error: " + e.message); });
- }
-
- adapter.setPowered(true, onSetPowered, function(e) {console.log ("Could not turn on Bluetooth adapter. reason: " + e.message); });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var clientSocket = null;
+
+/* Calls a method that is invoked when user wants to send a message to a remote device */
+function sendMessage(msg)
+{
+ /* Validates socket state, if everything is ok */
+ if (clientSocket != null && clientSocket.state == "OPEN")
+ {
+ /* Sends the message */
+ clientSocket.writeData(msg);
+ }
+}
+
+/* Calls a method that is invoked when a socket is open */
+function onSocketConnected(socket)
+{
+ clientSocket = socket;
+ console.log("Opening a socket successfully!!!");
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ var recvmsg = "";
+ for (var i = 0; i < data.length; i++)
+ {
+ recvmsg += String.fromCharCode(data[i]);
+ }
+ console.log("server msg >> " + recvmsg);
+ };
+
+ socket.onclose = function()
+ {
+ console.log("socket disconnected.");
+ };
+}
+
+function onDeviceReady(device)
+{
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e)
+ {
+ console.log("Error connecting to service. Reason: " + e.message);
+ });
+ }
+ else
+ {
+ console.log("Chat service is not supported by this device");
+ }
+}
+
+function onSetPowered()
+{
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+}
+
+adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message); });
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.address);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.address);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::name">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.name);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.name);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::txpowerlevel">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.txpowerlevel);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.txpowerlevel);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::appearance">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.appearance);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.appearance);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::uuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- var uuids = device.uuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++) {
- services += uuids[i] + "\n";
- }
- console.log ("Service found: " + services);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ var uuids = device.uuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Service found: " + services);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::solicitationuuids">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- var uuids = device.solicitationuuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++) {
- services += uuids[i] + "\n";
- }
- console.log ("Service solicitations found: " + services);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ var uuids = device.solicitationuuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Service solicitations found: " + services);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::serviceData">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- var serviceData = device.serviceData;
- var data = "";
- for (var i = 0; i < serviceData.length; i++) {
- data += serviceData[i].id + serviceData[i].data + "\n";
- }
- console.log ("Service data found: " + data);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ var serviceData = device.serviceData;
+ var data = "";
+ for (var i = 0; i < serviceData.length; i++)
+ {
+ data += serviceData[i].id + serviceData[i].data + "\n";
+ }
+ console.log("Service data found: " + data);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::manufacturerData">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- var manufacturerData = device.manufacturerData;
- console.log ("Manufacture id: " + manufacturerData.id);
- console.log ("Manufacture data: " + manufacturerData.data);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ var manufacturerData = device.manufacturerData;
+ console.log("Manufacture id: " + manufacturerData.id);
+ console.log("Manufacture data: " + manufacturerData.data);
+});
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothLEDevice::rssi">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- console.log("Found device: " + device.name);
- console.log("RSSI: " + device.rssi);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ console.log("Found device: " + device.name);
+ console.log("RSSI: " + device.rssi);
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Found device: beacon
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Failed to connect to device: " + e.message);
- }
-
- function onconnected() {
- console.log("Connected to device");
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(
- function onsuccess(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.connect(onconnected, onerror);
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Failed to connect to device: " + e.message);
+}
+
+function onconnected()
+{
+ console.log("Connected to device");
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(function onsuccess(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected, onerror);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::disconnect">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- function ondisconnect() {
- console.log("Disconnected");
- }
-
- function onconnected() {
- console.log("Connected to device");
- device.disconnect(ondisconnect, onerror);
- }
-
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.connect(onconnected, onerror);
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ function ondisconnect()
+ {
+ console.log("Disconnected");
+ }
+
+ function onconnected()
+ {
+ console.log("Connected to device");
+ device.disconnect(ondisconnect, onerror);
+ }
+
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected, onerror);
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::getService">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onconnected(device) {
- console.log("Connected to device");
- var service = device.getService(device.uuids[0]);
- console.log("Service got");
- }
-
- function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- if (device.address == "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.connect(onconnected.bind(null, device), onerror);
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onconnected(device)
+{
+ console.log("Connected to device");
+ var service = device.getService(device.uuids[0]);
+ console.log("Service got");
+}
+
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected.bind(null, device), onerror);
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::getServiceAllUuids">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // below variable should represent valid address of discoverable bluetooth low energy device
- var remoteAddress = "11:22:33:44:55:66";
-
- function onconnected(device) {
- console.log("Connected to device");
- var services = device.getServiceAllUuids();
- console.log("Services length " + services.length);
- }
-
- function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- if (device.address == remoteAddress) {
- device.connect(onconnected.bind(null, device), onerror);
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Below variable should represent valid address of discoverable bluetooth low energy device */
+var remoteAddress = "11:22:33:44:55:66";
+
+function onconnected(device)
+{
+ console.log("Connected to device");
+ var services = device.getServiceAllUuids();
+ console.log("Services length " + services.length);
+}
+
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ if (device.address == remoteAddress)
+ {
+ device.connect(onconnected.bind(null, device), onerror);
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Connected to device
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- var onConnectionStateChange = {
- onconnected: function(device) {
- console.log("Device " + device.name + " connected");
- },
- ondisconnected: function(device) {
- console.log("Device " + device.name + " disconnected");
- }
- }
-
- if (device.address === "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- device.addConnectStateChangeListener(onConnectionStateChange);
- device.connect();
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ var onConnectionStateChange =
+ {
+ onconnected: function(device)
+ {
+ console.log("Device " + device.name + " connected");
+ },
+ ondisconnected: function(device)
+ {
+ console.log("Device " + device.name + " disconnected");
+ }
+ }
+
+ if (device.address === "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.addConnectStateChangeListener(onConnectionStateChange);
+ device.connect();
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothLEDevice::removeConnectStateChangeListener">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onerror(e) {
- console.log("Error occured: " + e.message);
- }
-
- function onDeviceFound(device) {
- var onConnectionStateChange = {
- onconnected: function(device) {
- console.log("Device " + device.name + " connected");
- },
- ondisconnected: function(device) {
- console.log("Device " + device.name + " disconnected");
- device.removeConnectStateChangeListener(listenerID);
- }
- }
-
- if (device.address === "11:22:33:44:55:66") {
- console.log("Found device: " + device.name);
- listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
- device.connect();
- }
- }
-
- var adapter = tizen.bluetooth.getLEAdapter();
- var listenerID = null;
- adapter.startScan(onDeviceFound, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onerror(e)
+{
+ console.log("Error occurred: " + e.message);
+}
+
+function onDeviceFound(device)
+{
+ var onConnectionStateChange =
+ {
+ onconnected: function(device)
+ {
+ console.log("Device " + device.name + " connected");
+ },
+ ondisconnected: function(device)
+ {
+ console.log("Device " + device.name + " disconnected");
+ device.removeConnectStateChangeListener(listenerID);
+ }
+ }
+
+ if (device.address === "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
+ device.connect();
+ }
+}
+
+var adapter = tizen.bluetooth.getLEAdapter();
+var listenerID = null;
+adapter.startScan(onDeviceFound, onerror);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function onSocketConnected(socket) {
- console.log ("Opened connection to remote device");
- socket.onmessage = function () {
- console.log ("Message received: " + socket.readData());
- };
-
- socket.onclose = function() {
- console.log("Socket closed with " + socket.peer.name);
- };
-
- // Sends data to peer.
- var textmsg = "Test";
- var sendtextmsg = new Array();
- for (var i = 0; i < textmsg.length; i++)
- {
- sendtextmsg[i] = textmsg.charCodeAt(i);
- }
- socket.writeData (sendtextmsg);
- }
-
- function onSocketError(e) {
- console.log ("Error connecting to service. Reason: " + e.message);
- }
-
- function onDeviceReady(device) {
- // Validates device and service uuid.
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1) {
- // Opens socket
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onSocketError );
- }
- }
- function onSetPowered() {
- // Gets the BluetoothDevice object.
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) { console.log("Error: " + e.message); });
- }
-
- adapter.setPowered(true, onSetPowered, function(e) {console.log ("Could not turn on Bluetooth adapter. reason: " + e.message); });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function onSocketConnected(socket)
+{
+ console.log("Opened connection to remote device");
+ socket.onmessage = function()
+ {
+ console.log("Message received: " + socket.readData());
+ };
+
+ socket.onclose = function()
+ {
+ console.log("Socket closed with " + socket.peer.name);
+ };
+
+ /* Sends data to peer */
+ var textmsg = "Test";
+ var sendtextmsg = new Array();
+ for (var i = 0; i < textmsg.length; i++)
+ {
+ sendtextmsg[i] = textmsg.charCodeAt(i);
+ }
+ socket.writeData(sendtextmsg);
+}
+
+function onSocketError(e)
+{
+ console.log("Error connecting to service. Reason: " + e.message);
+}
+
+function onDeviceReady(device)
+{
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onSocketError);
+ }
+}
+
+function onSetPowered()
+{
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+}
+
+adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message);});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothSocket::readData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function onError(e) {
- console.log ("Error connecting to service. Reason: " + e.message);
- }
-
- function onSocketConnected(socket) {
- console.log ("Opening socket success!!!");
-
- socket.onmessage = function() {
- // Gets a message from peer, reads it
- var data = socket.readData();
-
- //
- // Code to evaluate message goes here
- //
- };
-
- socket.onclose = function() {
- console.log("Socket closed with " + socket.peer.name);
- };
- }
-
- function onDeviceReady(device) {
- // Validates device and service uuid
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1) {
- // Opens socket
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onError);
- }
- }
- function onSetPowered() {
- // Gets the BluetoothDevice object.
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) { console.log("Error: " + e.message); });
- }
-
- adapter.setPowered(true, onSetPowered, function(e) {console.log ("Could not turn on Bluetooth adapter. reason: " + e.message); });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function onError(e)
+{
+ console.log("Error connecting to service. Reason: " + e.message);
+}
+
+function onSocketConnected(socket)
+{
+ console.log("Opening socket success!!!");
+
+ socket.onmessage = function()
+ {
+ /* Gets a message from peer, reads it */
+ var data = socket.readData();
+
+ /* Code to evaluate message goes here */
+ };
+
+ socket.onclose = function()
+ {
+ console.log("Socket closed with " + socket.peer.name);
+ };
+}
+
+function onDeviceReady(device)
+{
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onError);
+ }
+}
+
+function onSetPowered()
+{
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+}
+
+adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message);});
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothSocket::close">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function evaluateDevice(address) {
- adapter.getDevice(address, function(device) {
- if (device.deviceClass.major == tizen.bluetooth.deviceMajor.COMPUTER) {
- // Shows computer icon for this device
- console.log("Device is computer");
- } else if (device.deviceClass.major == tizen.bluetooth.deviceMajor.PHONE) {
- // Shows phone icon
- console.log("Device is a Phone");
- }
- }, function(e) {
- console.log("Couldn't get any device with the given address: " + e.message);
- });
- }
-
- evaluateDevice("11:22:33:44:55:66");
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function evaluateDevice(address)
+{
+ adapter.getDevice(address, function(device)
+ {
+ if (device.deviceClass.major == tizen.bluetooth.deviceMajor.COMPUTER)
+ {
+ /* Shows computer icon for this device */
+ console.log("Device is computer");
+ }
+ else if (device.deviceClass.major == tizen.bluetooth.deviceMajor.PHONE)
+ {
+ /* Shows phone icon */
+ console.log("Device is a Phone");
+ }
+ }, function(e)
+ {
+ console.log("Couldn't get any device with the given address: " + e.message);
+ });
+}
+
+evaluateDevice("11:22:33:44:55:66");
+</pre>
</div>
</li>
<li class="attribute" id="BluetoothClass::minor">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- adapter.getDevice("12:34:56:78:9A:BC", function(device) {
- if (device.deviceClass.hasService(tizen.bluetooth.deviceService.POSITIONING)) {
- console.log("Device supports Positioning service");
- }
- }, function(e) {
- console.log("Couldn't get device for given address: " + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+adapter.getDevice("12:34:56:78:9A:BC", function(device)
+{
+ if (device.deviceClass.hasService(tizen.bluetooth.deviceService.POSITIONING))
+ {
+ console.log("Device supports Positioning service");
+ }
+}, function(e)
+{
+ console.log("Couldn't get device for given address: " + e.message);
+});
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
-
- function chatServiceSuccessCb(handler) {
- console.log("Chat service " + handler.name + " with UUID " + handler.uuid + " is successfully registered!");
- console.log("There is " + (handler.isConnected ? "a" : "no") + " device using this service");
-
- handler.onconnect = function(socket) {
- console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
- socket.onmessage = function() {
- var data = socket.readData();
- // Handle message code goes here
- //....
- };
-
- // Expected close
- socket.onclose = function() {
- console.log('The socket is closed.');
- };
- };
- }
-
- function errorCb(e) {
- console.log( "Could not register service record, Error: " + e.message);
- }
-
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb, errorCb);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+
+function chatServiceSuccessCb(handler)
+{
+ console.log("Chat service " + handler.name + " with UUID " + handler.uuid + " is successfully registered!");
+ console.log("There is " + (handler.isConnected ? "a" : "no") + " device using this service");
+
+ handler.onconnect = function(socket)
+ {
+ console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handle message code here */
+ };
+
+ /* Expected close */
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ };
+ };
+}
+
+function errorCb(e)
+{
+ console.log("Could not register service record, Error: " + e.message);
+}
+
+var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb, errorCb);
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var chatServiceHandler = null;
-
- function chatServiceSuccessCb(handler) {
- console.log("Chat service registration was successful!");
-
- chatServiceHandler = handler;
- handler.onconnect = function(socket) {
- console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
- socket.onmessage = function() {
- var data = socket.readData();
- // Handle message code goes here
- //....
- };
-
- // Expected close
- socket.onclose = function() {
- console.log('The socket is closed.');
- };
- };
- }
-
- function publishChatService() {
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
- // Error handler
- function(e) {
- console.log( "Could not register service record, Error: " + e.message);
- });
- }
-
- function unRegisterChatService() {
- if (chatServiceHandler != null) {
- chatServiceHandler.unregister(function() {
- chatServiceHandler = null;
- console.log("Chat service is unregistered.");
- },
- function(e) {
- console.log ("Error: " + e.message);
- });
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var chatServiceHandler = null;
+
+function chatServiceSuccessCb(handler)
+{
+ console.log("Chat service registration was successful!");
+
+ chatServiceHandler = handler;
+ handler.onconnect = function(socket)
+ {
+ console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handle message code here */
+ };
+
+ /* Expected close */
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ };
+ };
+}
+
+function publishChatService()
+{
+ var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+ adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
+ /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
+}
+
+function unRegisterChatService()
+{
+ if (chatServiceHandler != null)
+ {
+ chatServiceHandler.unregister(function()
+ {
+ chatServiceHandler = null;
+ console.log("Chat service is unregistered.");
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
+}
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.health");
-
- if (healthCapability) {
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- console.log("Bluetooth profile type is " + healthProfileHandler.profileType);
- } else {
- console.log("Bluetooth Health Profile is not supported on this device.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.health");
+
+if (healthCapability)
+{
+ var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+ console.log("Bluetooth profile type is " + healthProfileHandler.profileType);
+}
+else
+{
+ console.log("Bluetooth Health Profile is not supported on this device.");
+}
+</pre>
</div>
</li></ul>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- }
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+}
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothHealthProfileHandler::connectToSource">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- var registerHealthApp = null;
-
- function healthConnectSuccess(channel) {
- console.log("Health device is connected");
- var status = "Name of remote device: " + channel.peer.name +
- "channel type of device profile: " + channel.channelType +
- "health application name: " + channel.appication.name;
- console.log(status);
- }
-
- function healthConnectError(e) {
- console.log("Failed to connect to source: " + e.message);
- };
-
- function gotDeviceInfo(device) {
- healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess, healthConnectError);
- }
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- registerHealthApp = app;
- adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo);
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+var registerHealthApp = null;
+
+function healthConnectSuccess(channel)
+{
+ console.log("Health device is connected");
+ var status = "Name of remote device: " + channel.peer.name +
+ "channel type of device profile: " + channel.channelType +
+ "health application name: " + channel.appication.name;
+ console.log(status);
+}
+
+function healthConnectError(e)
+{
+ console.log("Failed to connect to source: " + e.message);
+};
+
+function gotDeviceInfo(device)
+{
+ healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess, healthConnectError);
+}
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ registerHealthApp = app;
+ adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo);
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- console.log("Data type used for communication is " + app.dataType);
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ console.log("Data type used for communication is " + app.dataType);
- app.onconnect = function(channel) {
- console.log("Health device is connected");
- }
- }
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ }
+}
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- var healthApp = null;
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- healthApp = app;
- healthApp.onconnect = function(channel) {
- console.log("Connected!!");
- };
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- function startSink() {
- try {
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- } catch(e) {
- console.log("Error: " + e.message);
- }
- }
-
- function stopSink() {
- try {
- if (healthApp != null) {
- healthApp.unregister(function() {
- healthApp = null;
- console.log("Health application is unregistered.");
- },
- function(e) {
- console.log ("Error: " + e.message);
- });
- }
- } catch(err) {
- console.log("Error: " + err.message);
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+var healthApp = null;
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ healthApp = app;
+ healthApp.onconnect = function(channel)
+ {
+ console.log("Connected!!");
+ };
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+function startSink()
+{
+ try
+ {
+ healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+ }
+ catch (e)
+ {
+ console.log("Error: " + e.message);
+ }
+}
+
+function stopSink()
+{
+ try
+ {
+ if (healthApp != null)
+ {
+ healthApp.unregister(function()
+ {
+ healthApp = null;
+ console.log("Health application is unregistered.");
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
+ }
+ catch (err)
+ {
+ console.log("Error: " + err.message);
+ }
+}
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
-
- function healthRegisterSuccess(app) {
- app.onconnect = function(channel) {
- console.log("Health device " + (channel.isConnected ? "is" : "is not") + " connected to " + channel.peer.name + " remote device");
- console.log("Channel type is " + channel.channelType + " and health application name used for communication is " + channel.application.name);
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+
+function healthRegisterSuccess(app)
+{
+ app.onconnect = function(channel)
+ {
+ console.log("Health device " + (channel.isConnected ? "is" : "is not") + " connected to " + channel.peer.name + " remote device");
+ console.log("Channel type is " + channel.channelType + " and health application name used for communication is " + channel.application.name);
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel) {;
- console.log("Health device is connected");
- channel.close();
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.close();
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothHealthChannel::sendData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
-
- // Data to send
- var textmsg = "Test";
- var dataToSend = new Array();
- for (var i = 0; i < textmsg.length; i++) {
- dataToSend[i] = textmsg.charCodeAt(i);
- }
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel) {
- console.log("Health device is connected");
- channel.sendData(dataToSend);
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+
+/* Data to send */
+var textmsg = "Test";
+var dataToSend = new Array();
+for (var i = 0; i < textmsg.length; i++)
+{
+ dataToSend[i] = textmsg.charCodeAt(i);
+}
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.sendData(dataToSend);
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothHealthChannel::setListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
-
- var channelCallback = {
- onmessage: function(data) {
- console.log("data is received")
- },
- onclose: function() {
- console.log("channel is closed");
- }
- };
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel) {;
- console.log("Health device is connected");
- channel.setListener(channelCallback);
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+
+var channelCallback =
+{
+ onmessage: function(data)
+ {
+ console.log("data is received")
+ },
+ onclose: function()
+ {
+ console.log("channel is closed");
+ }
+};
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.setListener(channelCallback);
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
<dt class="method" id="BluetoothHealthChannel::unsetListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.bluetooth.getDefaultAdapter();
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- var connectedChannel = null;
-
- var channelCallback = {
- onmessage: function(data) {
- console.log("data is received")
- },
- onclose: function() {
- console.log("channel is closed");
- connectedChannel.unsetListener();
- }
- };
-
- function healthRegisterSuccess(app) {
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel) {;
- console.log("Health device is connected");
- connectedChannel = channel;
- connectedChannel.setListener(channelCallback);
- }
- }
-
- function healthRegisterError(e) {
- console.log("Failed to register application: " + e.message);
- };
-
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.bluetooth.getDefaultAdapter();
+var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+var connectedChannel = null;
+
+var channelCallback =
+{
+ onmessage: function(data)
+ {
+ console.log("data is received")
+ },
+ onclose: function()
+ {
+ console.log("channel is closed");
+ connectedChannel.unsetListener();
+ }
+};
+
+function healthRegisterSuccess(app)
+{
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ connectedChannel = channel;
+ connectedChannel.setListener(channelCallback);
+ }
+}
+
+function healthRegisterError(e)
+{
+ console.log("Failed to register application: " + e.message);
+};
+
+healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Assume the content is a Content object as a result of find method.
- // Check the description is editable, and then set a description.
- if (content.editableAttributes.indexOf("description") >= 0) {
- content.description = "Sample content";
- }
- tizen.content.update(content);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assume the content is a Content object as a result of find method */
+/* Check the description is editable, and then set a description */
+if (content.editableAttributes.indexOf("description") >= 0)
+{
+ content.description = "Sample content";
+}
+tizen.content.update(content);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::updateBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example increases rating of an content by 1
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
-
- function successCB() {
- console.log('Attributes set successfully');
- }
-
- // Assume the content is a Content object as a result of find method.
- // Check the rating is editable, and then increase by 1.
- if (content.editableAttributes.indexOf("rating") >= 0) {
- content.rating++;
- }
- tizen.content.updateBatch([content], successCB, errorCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example increases rating of a content by 1 */
+
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function successCB()
+{
+ console.log('Attributes set successfully');
+}
+
+/* Assume the content is a Content object as a result of find method */
+/* Check the rating is editable, and then increase by 1 */
+if (content.editableAttributes.indexOf("rating") >= 0)
+{
+ content.rating++;
+}
+tizen.content.updateBatch([content], successCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::getDirectories">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example retrieves content directories in the storage.
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example retrieves content directories in the storage */
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function printDirectory(directory, index, directories) {
- console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
- }
- function getDirectoriesCB(directories) {
- directories.forEach(printDirectory);
- }
+function printDirectory(directory, index, directories)
+{
+ console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
+}
- tizen.content.getDirectories(getDirectoriesCB, errorCB);
- </pre>
+function getDirectoriesCB(directories)
+{
+ directories.forEach(printDirectory);
+}
+
+tizen.content.getDirectories(getDirectoriesCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::find">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the name.
- var count = 100;
- var offset = 0;
- var sortMode = new tizen.SortMode("name", "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('Name: ' + content.name + ' Title: ' + content.title + '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);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the name */
+var count = 100;
+var offset = 0;
+var sortMode = new tizen.SortMode("name", "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('Name: ' + content.name + ' Title: ' + content.title +
+ '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);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::scanFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example scan 'tizen.jpg' in media directory
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example scans 'tizen.jpg' in media directory */
- function successCB(path) {
- console.log('scanning is completed');
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- tizen.filesystem.resolve("images/tizen.jpg", function(imageFile) {
- tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
- });
+function successCB(path)
+{
+ console.log('scanning is completed');
+}
- </pre>
+tizen.filesystem.resolve("images/tizen.jpg", function(imageFile)
+{
+ tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
+});
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::scanDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // The following example scans 'images' directory
-
- function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Following example scans 'images' directory */
- function successCB(path) {
- console.log('scanning is completed');
- }
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- tizen.filesystem.resolve("images", function(directory) {
- tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
- });
+function successCB(path)
+{
+ console.log('scanning is completed');
+}
- </pre>
+tizen.filesystem.resolve("images", function(directory)
+{
+ tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
+});
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::cancelScanDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.content.cancelScanDirectory(directory.toURI());
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.content.cancelScanDirectory(directory.toURI());
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::addChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- // Adds the listener
- var listenerId = tizen.content.addChangeListener(listener);
-
- console.log('Listener ID: ' + listenerId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+/* Adds the listener */
+var listenerId = tizen.content.addChangeListener(listener);
+
+console.log('Listener ID: ' + listenerId);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Listener ID: 1
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- var listenerId = tizen.content.addChangeListener(listener);
-
- // Do some job here and when the listener is not needed anymore remove it
-
- // Removes the listener
- tizen.content.removeChangeListener(listenerId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+var listenerId = tizen.content.addChangeListener(listener);
+
+/* Do some job here and when the listener is not needed anymore remove it */
+
+/* Removes the listener */
+tizen.content.removeChangeListener(listenerId);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ContentManager::setChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener= {
- oncontentadded: function(content) {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content) {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id) {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir) {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id) {
- console.log(id + ' directory is removed');
- }
- };
-
- // Registers to be notified when the content changes
- tizen.content.setChangeListener(listener);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
+};
+
+/* Registers to be notified when the content changes */
+tizen.content.setChangeListener(listener);
+</pre>
</div>
</dd>
<dt class="deprecated method" id="ContentManager::unsetChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.content.unsetChangeListener();
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.content.unsetChangeListener();
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::getPlaylists">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::createPlaylist">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
- var gPlaylist;
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err.message);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
- }
-
- function findSuccess(contents) {
- if (contents.length > 0) {
- gPlaylist.add(contents[0]);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- }
-
- function findFail(err) {
- console.log("find FAIL: " + err.message);
- }
-
- function createSuccess(playlist) {
- console.log("create SUCCESS");
-
- gPlaylist = playlist;
- tizen.content.find(findSuccess, findFail, null,
- new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
- }
-
- function createFail(err) {
- console.log("create FAIL: " + err.message);
- }
-
- tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+var gPlaylist;
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err.message);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+}
+
+function findSuccess(contents)
+{
+ if (contents.length > 0)
+ {
+ gPlaylist.add(contents[0]);
+ }
+
+ tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+}
+
+function findFail(err)
+{
+ console.log("find FAIL: " + err.message);
+}
+
+function createSuccess(playlist)
+{
+ console.log("create SUCCESS");
+
+ gPlaylist = playlist;
+ tizen.content.find(findSuccess, findFail, null,
+ new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
+}
+
+function createFail(err)
+{
+ console.log("create FAIL: " + err.message);
+}
+
+tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::removePlaylist">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists;
-
- function removePlaylistSuccess() {
- console.log("removePlaylist SUCCESS");
- }
-
- function removePlaylistFail(err) {
- console.log("removePlaylist FAIL: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- var cur, i;
- gPlaylists = playlists;
- for(i = 0; i < gPlaylists.length; ++i) {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
-
- if(gPlaylists.length < 1) {
- console.log("Please add at least 1 playlist");
- return;
- }
-
- console.log("will remove playlist at index [0] name:"
- + gPlaylists[0].name);
-
- tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
- removePlaylistFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists;
+
+function removePlaylistSuccess()
+{
+ console.log("removePlaylist SUCCESS");
+}
+
+function removePlaylistFail(err)
+{
+ console.log("removePlaylist FAIL: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
+
+ if (gPlaylists.length < 1)
+ {
+ console.log("Please add at least 1 playlist");
+
+ return;
+ }
+
+ console.log("will remove playlist at index [0] name:"
+ + gPlaylists[0].name);
+
+ tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
+ removePlaylistFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="ContentManager::createThumbnail">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function createCB(path) {
- console.log("The thumbnail path is " + path);
- }
-
- function findCB(contents) {
- if (contents.length > 0) {
- tizen.content.createThumbnail(contents[0], createCB);
- }
- }
-
- tizen.content.find(findCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function createCB(path)
+{
+ console.log("The thumbnail path is " + path);
+}
+
+function findCB(contents)
+{
+ if (contents.length > 0)
+ {
+ tizen.content.createThumbnail(contents[0], createCB);
+ }
+}
+
+tizen.content.find(findCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> The thumbnail path is /home/owner/share/media/.thumb/phone/.jpg-bed1d5f494830f7a52e1217f1e924aff.jpg
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after remove) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist items:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 1) {
- console.log("Please add at least 1 tracks to playlist!");
- return;
- }
-
- console.log("Original playlist:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will remove item at index [0] name:" + gItems[0].content.name);
- gCurPlaylist.remove(gItems[0]);
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after remove) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 1)
+ {
+ console.log("Please add at least 1 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will remove item at index [0] name:" + gItems[0].content.name);
+ gCurPlaylist.remove(gItems[0]);
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::removeBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after remove batch) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist after remove batch:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function removeBatchSuccess() {
- console.log("removeBatch success");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function removeBatchFail(err) {
- console.log("removeBatch failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 4) {
- console.log("Please add at least 4 tracks to playlist!");
- return;
- }
-
- console.log("Original playlist:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will remove items at index [0](name:" + gItems[0].content.name
- + ") and at index [2](name:" + gItems[2].content.name + ")");
- gCurPlaylist.removeBatch([gItems[2], gItems[0]],
- removeBatchSuccess, removeBatchFail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after remove batch) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist after remove batch:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function removeBatchSuccess()
+{
+ console.log("removeBatch success");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function removeBatchFail(err)
+{
+ console.log("removeBatch failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 4)
+ {
+ console.log("Please add at least 4 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will remove items at index [0](name:" + gItems[0].content.name
+ + ") and at index [2](name:" + gItems[2].content.name + ")");
+ gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function getSuccess(items) {
- gItems = items;
- console.log("Playlist items:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].name);
- }
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- // To retrieves all playlist items of 'gCurPlaylist' playlist.
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function getSuccess(items)
+{
+ gItems = items;
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].name);
+ }
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ /* To retrieve all playlist items of 'gCurPlaylist' playlist */
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::setOrder">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist, gExpectedOrder;
-
- function get2Fail(err) {
- console.log("get items (after set order) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist order after setOrder:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function setOrderSuccess() {
- console.log("set items order SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function setOrderFail(err) {
- console.log("set items order failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 2) {
- console.log("Please add at least 2 tracks to playlist!");
- return;
- }
-
- console.log("Original order:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- gExpectedOrder = gItems.slice(0);
- gExpectedOrder.reverse();
-
- console.log("New order:");
- for(var i = 0; i < gExpectedOrder.length ; ++i) {
- console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
- }
-
- gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist, gExpectedOrder;
+
+function get2Fail(err)
+{
+ console.log("get items (after set order) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist order after setOrder:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function setOrderSuccess()
+{
+ console.log("set items order SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function setOrderFail(err)
+{
+ console.log("set items order failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ gExpectedOrder = gItems.slice(0);
+ gExpectedOrder.reverse();
+
+ console.log("New order:");
+ for (var i = 0; i < gExpectedOrder.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
+ }
+
+ gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
<dt class="method" id="Playlist::move">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gPlaylists, gItems, gCurPlaylist;
-
- function get2Fail(err) {
- console.log("get items (after move item) failed: " + err);
- }
-
- function get2Success(items) {
- console.log("Playlist order after move:");
- for(var i = 0; i < items.length ; ++i) {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
- }
-
- function moveSuccess() {
- console.log("move item SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
- }
-
- function moveFail(err) {
- console.log("move item failed: " + err);
- }
-
- function getSuccess(items) {
- gItems = items;
-
- if(gItems.length < 2) {
- console.log("Please add at least 2 tracks to playlist!");
- return;
- }
-
- console.log("Original order:");
- for(var i = 0; i < gItems.length ; ++i) {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
-
- console.log("Will move item at index [1] (name: " +
- gItems[1].content.name + ") up by one place (to [0])");
-
- gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
- gItems.unshift(gItems.splice(1, 1)[0]);
- }
-
- function getFail(err) {
- console.log("get items failed: " + err);
- }
-
- function getPlaylistsFail(err) {
- console.log("getPlaylists failed: " + err);
- }
-
- function getPlaylistsSuccess(playlists) {
- gPlaylists = playlists;
- if(gPlaylists.length === 0) {
- console.log("Please create at least 1 playlist!");
- return;
- }
-
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
- }
-
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gPlaylists, gItems, gCurPlaylist;
+
+function get2Fail(err)
+{
+ console.log("get items (after move item) failed: " + err);
+}
+
+function get2Success(items)
+{
+ console.log("Playlist order after move:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
+}
+
+function moveSuccess()
+{
+ console.log("move item SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
+}
+
+function moveFail(err)
+{
+ console.log("move item failed: " + err);
+}
+
+function getSuccess(items)
+{
+ gItems = items;
+
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
+
+ return;
+ }
+
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
+
+ console.log("Will move item at index [1] (name: " +
+ gItems[1].content.name + ") up by one place (to [0])");
+
+ gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
+ gItems.unshift(gItems.splice(1, 1)[0]);
+}
+
+function getFail(err)
+{
+ console.log("get items failed: " + err);
+}
+
+function getPlaylistsFail(err)
+{
+ console.log("getPlaylists failed: " + err);
+}
+
+function getPlaylistsSuccess(playlists)
+{
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
+
+ return;
+ }
+
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
+}
+
+tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+</pre>
</div>
</dd>
</dl>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Console API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Console API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Console">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log('A is for Alice.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log('A is for Alice.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>A is for Alice.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.error('B is for Bob.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.error('B is for Bob.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>B is for Bob.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.warn('C is for Christopher.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.warn('C is for Christopher.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>C is for Christopher.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.info('D is for Dorothy.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.info('D is for Dorothy.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>D is for Dorothy.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.debug('E is for Eve.');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.debug('E is for Eve.');</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>E is for Eve.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var felix = 'Felix';
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var felix = 'Felix';
- // This assertion checks whether the first letter in name 'Felix' is 'A':
- console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.');
- </pre>
+/* This assertion checks whether the first letter in name 'Felix' is 'A' */
+console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Felix does not start with A.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var john = {name: "John", surname: "Doe"};
- console.dir(john.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var john = {name: "John", surname: "Doe"};
+console.dir(john.name);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>John
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var john = {name: "John", surname: "Doe"};
- console.dirxml(john.surname);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var john = {name: "John", surname: "Doe"};
+console.dirxml(john.surname);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Doe
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.time("Big array initialization");
- var array = new Array(1000000);
- for (var i = array.length - 1; i >= 0; i -= 1) {
- array[i] = new Object();
- };
- console.timeEnd("Big array initialization");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.time("Big array initialization");
+var array = new Array(1000000);
+for (var i = array.length - 1; i >= 0; i -= 1)
+{
+ array[i] = new Object();
+};
+console.timeEnd("Big array initialization");
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Big array initialization: 461.989ms
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.time("Big array initialization");
- var array = new Array(1000000);
- for (var i = array.length - 1; i >= 0; i -= 1) {
- array[i] = new Object();
- };
- console.timeEnd("Big array initialization");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.time("Big array initialization");
+var array = new Array(1000000);
+for (var i = array.length - 1; i >= 0; i -= 1)
+{
+ array[i] = new Object();
+};
+console.timeEnd("Big array initialization");
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Big array initialization: 461.989ms
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Cordova API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Cordova API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Cordova">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>DeviceMotion API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>DeviceMotion API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::DeviceMotion">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
- </pre>
+navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- console.log('Please wait 3 seconds for the next measurement...');
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ console.log('Please wait 3 seconds for the next measurement...');
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- var options = { frequency: 3000 }; // Update every 3 seconds
+var options = {frequency: 3000}; /* Update every 3 seconds */
- var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
- </pre>
+var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var counter = 0, watchID;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var counter = 0, watchID;
- function onSuccess(acceleration) {
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- if(3 == ++counter) {
- navigator.accelerometer.clearWatch(watchID);
- }
- };
+function onSuccess(acceleration)
+{
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ if (3 == ++counter)
+ {
+ navigator.accelerometer.clearWatch(watchID);
+ }
+};
- function onError() {
- console.log('onError!');
- };
+function onError()
+{
+ console.log('onError!');
+};
- var options = { frequency: 30 }; // Update every 0.03 seconds
+var options = {frequency: 30}; /* Update every 0.03 seconds */
- watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
- </pre>
+watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Acceleration X: 0.00
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Device API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Device API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Device">
Returns the version of Cordova running on the device.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Cordova: ' + device.cordova);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Cordova: ' + device.cordova);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Cordova: 5.1.1
Get the the name of the device's model or product. The value is set by the device manufacturer and may be different across versions of the same product.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Model: ' + device.model);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Model: ' + device.model);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Model: tm1
Get the device's operating system name.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Platform: ' + device.platform);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Platform: ' + device.platform);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Platform: Tizen
Get the device's Universally Unique Identifier (UUID). The details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device UUID: ' + device.uuid);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device UUID: ' + device.uuid);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device UUID: 2LR1b3MXfEUSFvH04m4e1EXYvQA=
Get the operating system version.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- console.log('Device Version: ' + device.version);
- }
- </pre>
+function onDeviceReady()
+{
+ console.log('Device Version: ' + device.version);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device Version: 3.0
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Dialogs API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Dialogs API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Dialogs">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var alertDismissed = function() {
- console.log('Alert was dismissed');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var alertDismissed = function()
+{
+ console.log('Alert was dismissed');
+}
- navigator.notification.alert('Please click OK button', alertDismissed,
- 'OK click alert', 'OK');
- </pre>
+navigator.notification.alert('Please click OK button', alertDismissed,
+ 'OK click alert', 'OK');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Alert was dismissed
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var confirmCallback = function(buttonIndex) {
- console.log('Selected option was ' + buttonIndex);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var confirmCallback = function(buttonIndex)
+{
+ console.log('Selected option was ' + buttonIndex);
+}
- navigator.notification.confirm('Choose one option', confirmCallback,
- 'Options', ['Option1', 'Option2']);
- </pre>
+navigator.notification.confirm('Choose one option', confirmCallback,
+ 'Options', ['Option1', 'Option2']);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Selected option was 1
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var promptCallback = function(results) {
- console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var promptCallback = function(results)
+{
+ console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
+}
- navigator.notification.prompt('Please enter your name',
- promptCallback,
- 'Registration Box',
- ['Ok', 'Exit'],
- 'e.g. Jane Doe');
- </pre>
+navigator.notification.prompt('Please enter your name', promptCallback,
+ 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Hello Jane Doe, you selected option 1
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var times = 2;
- console.log('Device would beep ' + times + ' times');
- navigator.notification.beep(times);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var times = 2;
+console.log('Device would beep ' + times + ' times');
+navigator.notification.beep(times);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Device would beep 2 times
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Events API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Events API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Events">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.deviceready.html">Cordova deviceredy event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- // Now safe to use device APIs
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ /* Now safe to use device APIs */
+}
+</pre>
</div>
</div>
<div class="interface" id="PauseEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.pause.html">Cordova pause event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('pause', onPause, false);
- }
-
- function onPause() {
- // Handle the pause event
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('pause', onPause, false);
+}
+
+function onPause()
+{
+ /* Handle the pause event */
+}
+</pre>
</div>
</div>
<div class="interface" id="ResumeEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.resume.html">Cordova resume event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('resume', onResume, false);
- }
-
- function onResume() {
- // Handle the resume event
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('resume', onResume, false);
+}
+
+function onResume()
+{
+ /* Handle the resume event */
+}
+</pre>
</div>
</div>
<div class="interface" id="BackButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.backbutton.html">Cordova backbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('backbutton', onBackKeyDown, false);
- }
-
- function onBackKeyDown() {
- // Handle the back button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('backbutton', onBackKeyDown, false);
+}
+
+function onBackKeyDown()
+{
+ /* Handle the back button */
+}
+</pre>
</div>
</div>
<div class="interface" id="MenuButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.menubutton.html">Cordova menubutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('menubutton', onMenuKeyDown, false);
- }
-
- function onMenuKeyDown() {
- // Handle the back button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('menubutton', onMenuKeyDown, false);
+}
+
+function onMenuKeyDown()
+{
+ /* Handle the back button */
+}
+</pre>
</div>
</div>
<div class="interface" id="SearchButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.searchbutton.html">Cordova searchbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('searchbutton', onSearchKeyDown, false);
- }
-
- function onSearchKeyDown() {
- // Handle the search button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('searchbutton', onSearchKeyDown, false);
+}
+
+function onSearchKeyDown()
+{
+ /* Handle the search button */
+}
+</pre>
</div>
</div>
<div class="interface" id="StartCallEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.startcallbutton.html">Cordova startcallbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('startcallbutton', onStartCallKeyDown, false);
- }
-
- function onStartCallKeyDown() {
- // Handle the start call button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('startcallbutton', onStartCallKeyDown, false);
+}
+
+function onStartCallKeyDown()
+{
+ /* Handle the start call button */
+}
+</pre>
</div>
</div>
<div class="interface" id="EndCallButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.endcallbutton.html">Cordova endcallbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('endcallbutton', onEndCallKeyDown, false);
- }
-
- function onEndCallKeyDown() {
- // Handle the end call button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('endcallbutton', onEndCallKeyDown, false);
+}
+
+function onEndCallKeyDown()
+{
+ /* Handle the end call button */
+}
+</pre>
</div>
</div>
<div class="interface" id="VolumeDownButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.volumedownbutton.html">Cordova volumedownbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
- }
-
- function onVolumeDownKeyDown() {
- // Handle the volume down button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
+}
+
+function onVolumeDownKeyDown()
+{
+ /* Handle the volume down button */
+}
+</pre>
</div>
</div>
<div class="interface" id="VolumeUpButtonEventCallback">
Original documentation: <a href="https://cordova.apache.org/docs/en/latest/cordova/events/events.volumeupbutton.html">Cordova volumeupbutton event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
-
- function onDeviceReady() {
- document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
- }
-
- function onVolumeUpKeyDown() {
- // Handle the volume up button
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady()
+{
+ document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
+}
+
+function onVolumeUpKeyDown()
+{
+ /* Handle the volume up button */
+}
+</pre>
</div>
</div>
</div>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>File API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>File API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::File">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var eventInit = {
- loaded: 128,
- total: 1024
- };
- var event = new ProgressEvent('submit', eventInit);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var eventInit =
+{
+ loaded: 128,
+ total: 1024
+};
+var event = new ProgressEvent('submit', eventInit);
+</pre>
</div>
<div class="constructors">
<h4 id="ProgressEvent::constructor">Constructors</h4>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The directory where the application is installed " + cordova.file.applicationDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("The directory where the application is installed " + cordova.file.applicationDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>The directory where the application is installed file:///opt/usr/apps/WfigBlWDyf/res/wgt/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Root directory of the application's sandbox file:///opt/usr/apps/WfigBlWDyf/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Data directory " + cordova.file.dataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Data directory " + cordova.file.dataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Data directory file:///opt/usr/apps/WfigBlWDyf/data/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Cache directory " + cordova.file.cacheDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Cache directory " + cordova.file.cacheDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Cache directory file:///opt/usr/apps/WfigBlWDyf/tmp/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Space on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Data files on external storage " + cordova.file.externalDataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Data files on external storage " + cordova.file.externalDataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Data files on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Cache on external storage " + cordova.file.externalCacheDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Cache on external storage " + cordova.file.externalCacheDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Cache on external storage null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Root on external storage " + cordova.file.externalRootDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Root on external storage " + cordova.file.externalRootDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Root on external storage file:///usr/storage/sdcard/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Temp directory " + cordova.file.tempDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Temp directory " + cordova.file.tempDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Temp directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Synced data directory " + cordova.file.syncedDataDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Synced data directory " + cordova.file.syncedDataDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Synced data directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Documents directory " + cordova.file.documentsDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Documents directory " + cordova.file.documentsDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Documents directory null
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("Files globally available to all applications " + cordova.file.sharedDirectory);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log("Files globally available to all applications " + cordova.file.sharedDirectory);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Files globally available to all applications file:///opt/usr/media/
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function (fileSystem) {
- console.log('Name of the filesystem: '+fileSystem.name);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fileSystem)
+{
+ console.log('Name of the filesystem: ' + fileSystem.name);
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Name of the filesystem: temporary
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(fs) {
- console.log('File system name ' + fs.name);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- requestFileSystem(TEMPORARY, 1024*1024, successCallback, errorCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(fs)
+{
+ console.log('File system name ' + fs.name);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>File system name temporary
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry) {
- console.log('Entry name ' + entry.name);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- var uri = 'file:///home/owner/content/Documents/example.txt';
- resolveLocalFileSystemURL(uri, successCallback, errorCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry)
+{
+ console.log('Entry name ' + entry.name);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+var uri = 'file:///home/owner/content/Documents/example.txt';
+resolveLocalFileSystemURL(uri, successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Entry name example.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getMetadata(function (metadata) {
- console.log("Last modification time: " + metadata.modificationTime);// get metadata successfully
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getMetadata(function(metadata)
+ {
+ console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Last modification time: Fri Jan 02 2015 03:58:08 GMT+0900 (KST)
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry){console.log('Full path to the moved file: '+entry.fullPath)};
- requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry) {
- fs.root.getFile("aa.txt", {create:true}, function(fileentry) {
- console.log('Full path before move: '+fileentry.fullPath);
- fileentry.moveTo(direntry,'newname.txt',successCallback);
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry) {console.log('Full path to the moved file: ' + entry.fullPath)};
+
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("aa.txt", {create:true}, function(fileentry)
+ {
+ console.log('Full path before move: ' + fileentry.fullPath);
+ fileentry.moveTo(direntry, 'newname.txt', successCallback);
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Full path before move: /aa.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(entry){console.log('Full path to the copied file: '+entry.fullPath);};
- requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true},
- function(direntry) {
- fs.root.getFile("test.txt", {create:true},
- function(fileentry) {
- fileentry.copyTo(direntry,'newname.txt',successCallback);
- }
- );
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(entry) {console.log('Full path to the copied file: ' + entry.fullPath);};
+
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("test.txt", {create:true}, function(fileentry)
+ {
+ fileentry.copyTo(direntry, 'newname.txt', successCallback);
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Full path to the copied file: /testDirectory/newname.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getParent(function (entry) {
- console.log("success");
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getParent(function(entry)
+ {
+ console.log("success");
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile('test.txt', {create: true}, function(fileEntry) {
- fileEntry.remove(function () {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile('test.txt', {create: true}, function(fileEntry)
+ {
+ fileEntry.remove(function()
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
URL that can be used to identify this entry.
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory('testDirectory', {create:true},
- function(entry) {
- var url = entry.toURL();
- console.log('URL: '+url);
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory('testDirectory', {create:true}, function(entry)
+ {
+ var url = entry.toURL();
+ console.log('URL: ' + url);
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>URL: file:///home/owner/apps_rw/WfigBlWDyf/tmp/testDirectory/
DirectoryReader
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function (entry) {
- entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry) {
- var directoryReader = dirEntry.createReader();
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(entry)
+{
+ entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
+ {
+ var directoryReader = dirEntry.createReader();
+ });
+});
+</pre>
</div>
</dd>
<dt class="method" id="DirectoryEntry::getDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory("ert",{create:true},function(dir){
- console.log('Created dir: '+dir.name);
- })
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory("ert", {create:true}, function(dir)
+ {
+ console.log('Created dir: ' + dir.name);
+ })
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Created dir: ert
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("qa.txt",{create:true},function(file){
- console.log('Created file: '+file.name);
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("qa.txt", {create:true}, function(file)
+ {
+ console.log('Created file: ' + file.name);
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Created file: qa.txt
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getDirectory("testDirectory", {create:true},
- function(directoryEntry) {
- directoryEntry.removeRecursively(function() {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
+ {
+ directoryEntry.removeRecursively(function()
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- var a = fs.root.createReader();
- a.readEntries(function successCallback(entries) {
- console.log("success");
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ var a = fs.root.createReader();
+ a.readEntries(function successCallback(entries)
+ {
+ console.log("success");
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("logFile.txt", {create: true}, function (f) {
- f.createWriter(function(fileWriter) {
- fileWriter.write(new Blob(['hello']));
- fileWriter.onerror = function(e) {
- console.log('Write file failed:' + e);
- };
- fileWriter.onwriteend = function () {
- console.log("success");
- };
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("logFile.txt", {create: true}, function(f)
+ {
+ f.createWriter(function(fileWriter)
+ {
+ fileWriter.write(new Blob(['hello']));
+ fileWriter.onerror = function(e)
+ {
+ console.log('Write file failed:' + e);
+ };
+ fileWriter.onwriteend = function()
+ {
+ console.log("success");
+ };
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> requestFileSystem(TEMPORARY, 100, function(fs) {
- fs.root.getFile("abcdz.txt", {create: true}, function (f) {
- f.file(function (file) {
- console.log("success");
- });
- });
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+requestFileSystem(TEMPORARY, 100, function(fs)
+{
+ fs.root.getFile("abcdz.txt", {create: true}, function(f)
+ {
+ f.file(function(file)
+ {
+ console.log("success");
+ });
+ });
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>success
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var deviceReady, fileReader;
- deviceReady = function() {
- fileReader = new FileReader();
- };
- document.addEventListener('deviceready', deviceReady, true);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var deviceReady, fileReader;
+deviceReady = function()
+{
+ fileReader = new FileReader();
+};
+document.addEventListener('deviceready', deviceReady, true);
+</pre>
</div>
<div class="constructors">
<h4 id="FileReader::constructor">Constructors</h4>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded');
- };
- fileReader.onabort = function(){
- console.log('aborted');
- };
- fileReader.readAsDataURL(blob);
- fileReader.abort();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded');
+};
+fileReader.onabort = function()
+{
+ console.log('aborted');
+};
+fileReader.readAsDataURL(blob);
+fileReader.abort();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>aborted
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsDataURL(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsDataURL(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = data:;base64,YWJj
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsText(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsText(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = abc
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- console.log('Loaded, result = '+fileReader.result);
- };
- fileReader.readAsBinaryString(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ console.log('Loaded, result = ' + fileReader.result);
+};
+fileReader.readAsBinaryString(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Loaded, result = abc
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var blob = new Blob(['abc']);
- var fileReader = new FileReader();
- fileReader.onload = function(){
- resultValue = fileReader.result;
- console.log("Result: "+resultValue.toString()+'<br>'+'ByteLength: '+resultValue.byteLength);
- };
- fileReader.readAsArrayBuffer(blob);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var blob = new Blob(['abc']);
+var fileReader = new FileReader();
+fileReader.onload = function()
+{
+ resultValue = fileReader.result;
+ console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
+};
+fileReader.readAsArrayBuffer(blob);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Result: [object ArrayBuffer]
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('write success');
- };
- writer.onabort = function(e){
- console.log('abort');
- };
- writer.write('some sample text');
- writer.abort();
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+ writer.onabort = function(e)
+ {
+ console.log('abort');
+ };
+ writer.write('some sample text');
+ writer.abort();
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>abort
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- // fast forwards file pointer to the end of file.
- writer.seek(writer.length);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ /* Fast forwards file pointer to the end of file */
+ writer.seek(writer.length);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="FileWriter::truncate">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('truncate success');
- };
-
- writer.truncate(10);
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('truncate success');
+ };
+
+ writer.truncate(10);
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>truncate success
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function(writer) {
- writer.onwrite = function(evt) {
- console.log('write success');
- };
-
- writer.write('some sample text');
- };
-
- errorCallback = function(err) {
- console.log(err.code);
- };
-
- // entry is FileEntry object retrieved by getFile() function of DirectoryEntry interface.
- entry.createWriter(successCallback, errorCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function(writer)
+{
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+
+ writer.write('some sample text');
+};
+
+errorCallback = function(err)
+{
+ console.log(err.code);
+};
+
+/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
+entry.createWriter(successCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>write success
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>FileTransfer API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>FileTransfer API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::FileTransfer">
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // We assume the variable fileURL contains a valid URL to a text file on the device.
-
- var win = function (r) {
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
- }
-
- var fail = function (error) {
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- }
-
- var options = new FileUploadOptions();
- options.fileKey = 'file';
- options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
- options.mimeType = 'text/plain';
-
- var params = {};
- params.value1 = 'test';
- params.value2 = 'param';
-
- options.params = params;
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail, options);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Assume the variable fileURL contains a valid URL to a text file on the device */
+
+var win = function(r)
+{
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
+}
+
+var fail = function(error)
+{
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+}
+
+var options = new FileUploadOptions();
+options.fileKey = 'file';
+options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
+options.mimeType = 'text/plain';
+
+var params = {};
+params.value1 = 'test';
+params.value2 = 'param';
+
+options.params = params;
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail, options);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Code = 200
<dl>
<pre class="webidl prettyprint">FileUploadOptions(DOMString fileKey, DOMString fileName, DOMString mimeType, <a href="#FileUploadParams">FileUploadParams</a> params, <a href="#HeaderFields">HeaderFields</a> headers, DOMString httpMethod);</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a FileUploadOptions object.
- var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a FileUploadOptions object */
+var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
+</pre>
</div>
</dl>
</div>
<dl>
<pre class="webidl prettyprint">FileTransfer();</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a FileTransfer object.
- var file_transfer = new FileTransfer();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a FileTransfer object */
+var file_transfer = new FileTransfer();
+</pre>
</div>
</dl>
</div>
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function(r) {
- console.log('Success. File uploaded.');
- }
-
- var fail = function(error) {
- // error.code == FileTransferError.ABORT_ERR
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- };
-
- var ft = new FileTransfer();
-
- ft.onprogress = function(event) {
- console.log('uploaded: ' + event.loaded);
- };
-
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Success. File uploaded.');
+}
+
+var fail = function(error)
+{
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+};
+
+var ft = new FileTransfer();
+
+ft.onprogress = function(event)
+{
+ console.log('uploaded: ' + event.loaded);
+};
+
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>uploaded: 512
uploaded: 1024
-Success. File uploaded.
+Success. File uploaded.
</pre>
</div>
</li></ul>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function (r) {
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
- }
-
- var fail = function (error) {
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- }
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
+}
+
+var fail = function(error)
+{
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+}
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Code = 200
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var fileTransfer = new FileTransfer();
- var uri = encodeURI('http://some.server.com/download.php');
-
- fileTransfer.download(
- uri,
- fileURL,
- function(entry) {
- console.log('download complete: ' + entry.toURL());
- },
- function(error) {
- console.log('download error source ' + error.source);
- console.log('download error target ' + error.target);
- console.log('upload error code' + error.code);
- },
- false,
- {
- headers: {
- 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
- }
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var fileTransfer = new FileTransfer();
+var uri = encodeURI('http://some.server.com/download.php');
+
+fileTransfer.download(uri, fileURL, function(entry)
+{
+ console.log('download complete: ' + entry.toURL());
+}, function(error)
+{
+ console.log('download error source ' + error.source);
+ console.log('download error target ' + error.target);
+ console.log('upload error code' + error.code);
+}, false,
+{
+ headers:
+ {
+ 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
+ }
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>download complete: file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
http://tizen.org/privilege/internet
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var fileURL; // should be a valid url eg. cdvfile://localhost/persistent/path/to/file.txt
-
- var win = function(r) {
- console.log('Should not be called.');
- }
-
- var fail = function(error) {
- // error.code == FileTransferError.ABORT_ERR
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
- };
-
- var ft = new FileTransfer();
- ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
- ft.abort();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var fileURL; /* Must be a valid url, such as cdvfile://localhost/persistent/path/to/file.txt */
+
+var win = function(r)
+{
+ console.log('Should not be called.');
+}
+
+var fail = function(error)
+{
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
+};
+
+var ft = new FileTransfer();
+ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
+ft.abort();
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre>An error has occured: Code = 4
+<span class="title"><p>Output example:</p></span><pre>An error has occurred: Code = 4
upload error source file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
upload error target http://some.server.com/file.txt
</pre>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Globalization API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Globalization API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Globalization">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output the text
- // similar to the results that follow.
-
- navigator.globalization.getPreferredLanguage(
- function (language) { console.log('Language: ' + language.value); },
- function () { console.log('Error getting language.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text
+ similar to the results that follow
+*/
+navigator.globalization.getPreferredLanguage(function(language)
+{
+ console.log('Language: ' + language.value);
+}, function()
+{
+ console.log('Error getting language.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Language: en-US
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output the text
- // similar to the results that follow.
-
- navigator.globalization.getLocaleName(
- function (locale) { console.log('Locale: ' + locale.value); },
- function () { console.log('Error getting locale.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text
+ similar to the results that follow
+*/
+navigator.globalization.getLocaleName(function(locale)
+{
+ console.log('Locale: ' + locale.value);
+}, function()
+{
+ console.log('Error getting locale.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Locale: en-US
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US language,
- // this should output text similar to the results that follow.
- // This example uses the default conversion options.
-
- navigator.globalization.dateToString(
- new Date(),
- function (date) { console.log('Date: ' + date.value); },
- function () { console.log('Error getting dateString.'); },
- { formatLength: 'short', selector: 'date and time' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this outputs the text similar to the results that follow
+ This example uses the default conversion options
+*/
+navigator.globalization.dateToString(new Date(), function(date)
+{
+ console.log('Date: ' + date.value);
+}, function()
+{
+ console.log('Error getting dateString.');
+}, {formatLength: 'short', selector: 'date and time'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Date: 9/25/2012 4:21PM
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en-US locale and the selected
- // currency is United States Dollars, this example outputs
- // text similar to the results that follow.
-
- navigator.globalization.getCurrencyPattern(
- 'USD',
- function (pattern) {
- console.log('pattern: ' + pattern.pattern);
- console.log('code: ' + pattern.code);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
- },
- function () { console.log('Error getting pattern.'); }
- );
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ and the selected currency is United States Dollars,
+ this outputs the text similar to the results that follow
+*/
+navigator.globalization.getCurrencyPattern('USD', function(pattern)
+{
+ console.log('pattern: ' + pattern.pattern);
+ console.log('code: ' + pattern.code);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
+}, function()
+{
+ console.log('Error getting pattern.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>pattern: $#,##0.##;($#,##0.##)
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this example logs the names of months, as per locale settings,
- // with text similar to the results that follow.
-
- navigator.globalization.getDateNames(
- function (names) {
- for (var i = 0; i < names.value.length; i++) {
- console.log('month: ' + names.value[i]);
- }
- },
- function () { console.log('Error getting names.'); },
- { type: 'wide', item: 'months' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en-US language,
+ this example logs the names of months, as per locale settings
+ with text similar to the results that follow
+*/
+navigator.globalization.getDateNames(function(names)
+{
+ for (var i = 0; i < names.value.length; i++)
+ {
+ console.log('month: ' + names.value[i]);
+ }
+}, function()
+{
+ console.log('Error getting names.');
+}, {type: 'wide', item: 'months'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>month: January
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // This example displays the locale date pattern.
- // When the browser is set to the en_US locale,
- // the text displayed is similar to the results that follow.
-
- function checkDatePattern () {
- navigator.globalization.getDatePattern(
- function (date) { console.log('Date pattern: ' + date.pattern); },
- function () { console.log('Error getting pattern'); },
- { formatLength: 'short', selector: 'date and time' }
- );
- }
-
- checkDatePattern();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ This example displays the locale date pattern
+ When the browser is set to the en-US locale,
+ this outputs the text similar to the results that follow
+*/
+function checkDatePattern()
+{
+ navigator.globalization.getDatePattern(function(date)
+ {
+ console.log('Date pattern: ' + date.pattern);
+ }, function()
+ {
+ console.log('Error getting pattern');
+ }, {formatLength: 'short', selector: 'date and time'});
+}
+
+checkDatePattern();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Date pattern: M/d/yyyy h:mm a
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this outputs the text similar to "day: 1".
-
- navigator.globalization.getFirstDayOfWeek(
- function (day) { console.log('day: ' + day.value); },
- function () { console.log('Error getting first day of week.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this outputs the text similar to "day: 1"
+*/
+navigator.globalization.getFirstDayOfWeek(function(day)
+{
+ console.log('day: ' + day.value);
+}, function()
+{
+ console.log('Error getting first day of week.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>day: 1
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this example outputs the text
- // similar to the results that follow.
-
- navigator.globalization.getNumberPattern(
- function (pattern) {
- console.log('pattern: ' + pattern.pattern);
- console.log('symbol: ' + pattern.symbol);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('positive: ' + pattern.positive);
- console.log('negative: ' + pattern.negative);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
- },
- function() { console.log('An error occurred.'); },
- { type: 'decimal' }
- );
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this outputs the text similar to the results that follow
+*/
+navigator.globalization.getNumberPattern(function(pattern)
+{
+ console.log('pattern: ' + pattern.pattern);
+ console.log('symbol: ' + pattern.symbol);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('positive: ' + pattern.positive);
+ console.log('negative: ' + pattern.negative);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
+}, function()
+{
+ console.log('An error occurred.');
+}, {type: 'decimal'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>pattern: #,##0.###
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // During the summer, and if the browser
- // is set to a DST-enabled timezone,
- // this should log text similar to "dst: true":
-
- navigator.globalization.isDayLightSavingsTime(
- new Date(),
- function (date) { console.log('dst: ' + date.dst); },
- function () { console.log('Error getting the DST state.'); }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ During the summer, and if the browser is set to a DST-enabled timezone,
+ this logs text similar to "dst: true"
+*/
+navigator.globalization.isDayLightSavingsTime(new Date(), function(date)
+{
+ console.log('dst: ' + date.dst);
+}, function()
+{
+ console.log('Error getting the DST state.');
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>dst: true
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this code displays the results that follow.
-
- navigator.globalization.numberToString(
- 3.1415926,
- function (number) { console.log('decimal number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
-
- navigator.globalization.numberToString(
- 1000003,
- function (number) { console.log('big decimal number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
-
- navigator.globalization.numberToString(
- 0.3183099,
- function (number) { console.log('percentile: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'percent' }
- );
-
- navigator.globalization.numberToString(
- 1099.95,
- function (number) { console.log('currency: ' + number.value); },
- function () { console.log('Error getting number'); },
- { type: 'currency' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this code displays the results that follow
+*/
+navigator.globalization.numberToString(3.1415926, function(number)
+{
+ console.log('decimal number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+
+navigator.globalization.numberToString(1000003, function(number)
+{
+ console.log('big decimal number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+
+navigator.globalization.numberToString(0.3183099, function(number)
+{
+ console.log('percentile: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'percent'});
+
+navigator.globalization.numberToString(1099.95, function(number)
+{
+ console.log('currency: ' + number.value);
+}, function()
+{
+ console.log('Error getting number');
+}, {type: 'currency'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>decimal number: 3.142
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // when the browser is set to the en_US locale,
- // this example outputs text similar to the results that follow.
- // Note that the month integer is one less than the string,
- // as the month integer represents an array index.
-
- navigator.globalization.stringToDate(
- '9/25/2012',
- function (date) {
- console.log('month: ' + date.month +
- ', day: ' + date.day +
- ', year: ' + date.year)
- },
- function () { console.log('Error getting date.'); },
- { selector: 'date' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this example outputs text similar to the results that follow
+ Note that the month integer is one less than the string,
+ as the month integer represents an array index
+*/
+navigator.globalization.stringToDate('9/25/2012', function(date)
+{
+ console.log('month: ' + date.month +
+ ', day: ' + date.day +
+ ', year: ' + date.year)
+}, function()
+{
+ console.log('Error getting date.');
+}, {selector: 'date'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>month: 8, day: 25, year: 2012
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // When the browser is set to the en_US locale,
- // this should display the text similar to the results that follow.
-
- navigator.globalization.stringToNumber(
- '1234.56',
- function (number) { console.log('number: ' + number.value); },
- function () { console.log('Error getting number.'); },
- { type: 'decimal' }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ When the browser is set to the en_US locale,
+ this displays the text similar to the results that follow
+*/
+navigator.globalization.stringToNumber('1234.56', function(number)
+{
+ console.log('number: ' + number.value);
+}, function()
+{
+ console.log('Error getting number.');
+}, {type: 'decimal'});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>number: 1234.56
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>Media API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>Media API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Media">
void stop();
};</pre>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var myMedia = new Media(src, successCallback, errorCallback, statusCallback);</pre>
</div>
<div class="constructors">
<h4 id="Media::constructor">Constructors</h4>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- positionSuccessCallback = function(position) {
- console.log('Current position is ' + position);
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- setTimeout(function() {
- myMedia.getCurrentPosition(positionSuccessCallback);
- }, 2000);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+positionSuccessCallback = function(position)
+{
+ console.log('Current position is ' + position);
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+setTimeout(function()
+{
+ myMedia.getCurrentPosition(positionSuccessCallback);
+}, 2000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been played back.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.);
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- var duration = myMedia.getDuration();
- console.log('Audio duration is ' + duration);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+var duration = myMedia.getDuration();
+console.log('Audio duration is ' + duration);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio duration is 281.035
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- statusCallback = function(status) {
- if (status == Media.MEDIA_PAUSED) {
- console.log('Audio file has been paused');
- }
- }
-
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
-
- myMedia.play();
-
- //Pause after 2 seconds
- setTimeout(function() {
- myMedia.pause();
- }, 2000);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+statusCallback = function(status)
+{
+ if (status == Media.MEDIA_PAUSED)
+ {
+ console.log('Audio file has been paused');
+ }
+}
+
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback, statusCallback);
+
+myMedia.play();
+
+/* Pause after 2 seconds */
+setTimeout(function()
+{
+ myMedia.pause();
+}, 2000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been paused.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
- var src = 'file:///home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
+var src = 'file:///home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
- myMedia.play();
- </pre>
+myMedia.play();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been played back.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been stopped or released.');
- }
-
- errorCallback = function(err) {
- console.log('An error occurred: ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
- myMedia.stop();
- myMedia.release();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been stopped or released.');
+}
+
+errorCallback = function(err)
+{
+ console.log('An error occurred: ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+myMedia.stop();
+myMedia.release();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio file has been stopped or released.
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('An error occurred: ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- //SeekTo to 10 seconds after 5 seconds
- setTimeout(function() {
- myMedia.seekTo(10000);
- console.log('Playback position has been set to 10 seconds.');
- }, 5000);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('An error occurred: ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* SeekTo to 10 seconds after 5 seconds */
+setTimeout(function()
+{
+ myMedia.seekTo(10000);
+ console.log('Playback position has been set to 10 seconds.');
+}, 5000);
</pre>
</div>
<div class="output">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been played back.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- // Mute volume after 2 seconds
- setTimeout(function() {
- myMedia.setVolume(0.0);
- console.log('Playback volume has been muted.');
- }, 2000);
-
- // Set volume to 1.0 after 5 seconds
- setTimeout(function() {
- myMedia.setVolume(1.0);
- console.log('Playback volume has been set to 1.0.');
- }, 5000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been played back.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* Mute volume after 2 seconds */
+setTimeout(function()
+{
+ myMedia.setVolume(0.0);
+ console.log('Playback volume has been muted.');
+}, 2000);
+
+/* Set volume to 1.0 after 5 seconds */
+setTimeout(function()
+{
+ myMedia.setVolume(1.0);
+ console.log('Playback volume has been set to 1.0.');
+}, 5000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Playback volume has been muted.
http://tizen.org/privilege/mediacapture
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Started recording an audio file.');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Started recording an audio file.');
+}
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
- var src = 'recordAudio.mp3';
- var myRecMedia = new Media(src, successCallback, errorCallback);
+var src = 'recordAudio.mp3';
+var myRecMedia = new Media(src, successCallback, errorCallback);
- myRecMedia.startRecord();
- </pre>
+myRecMedia.startRecord();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Started recording an audio file.
http://tizen.org/privilege/mediacapture
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Started recording an audio file.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'recordAudio.mp3';
- var myRecMedia = new Media(src, successCallback, errorCallback);
-
- myRecMedia.startRecord();
-
- // Stop recording after 10 seconds
- setTimeout(function() {
- myRecMedia.stopRecord();
- console.log('Stopped recording an audio file.');
- }, 10000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Started recording an audio file.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'recordAudio.mp3';
+var myRecMedia = new Media(src, successCallback, errorCallback);
+
+myRecMedia.startRecord();
+
+/* Stop recording after 10 seconds */
+setTimeout(function()
+{
+ myRecMedia.stopRecord();
+ console.log('Stopped recording an audio file.');
+}, 10000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Started recording an audio file.
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> successCallback = function() {
- console.log('Audio file has been stopped.');
- }
-
- errorCallback = function(err) {
- console.log('Error occurred ' + err.message);
- }
-
- var src = 'file://home/app/content/Documents/play.mp3';
- var myMedia = new Media(src, successCallback, errorCallback);
-
- myMedia.play();
-
- // Stop after 10 seconds
- setTimeout(function() {
- myMedia.stop();
- }, 10000);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+successCallback = function()
+{
+ console.log('Audio file has been stopped.');
+}
+
+errorCallback = function(err)
+{
+ console.log('Error occurred ' + err.message);
+}
+
+var src = 'file://home/app/content/Documents/play.mp3';
+var myMedia = new Media(src, successCallback, errorCallback);
+
+myMedia.play();
+
+/* Stop after 10 seconds */
+setTimeout(function()
+{
+ myMedia.stop();
+}, 10000);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Audio playback has been stopped.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../tizen.css" media="screen">
-<script type="text/javascript" src="snippet.js"></script><title>NetworkInformation API</title>
+<script type="text/javascript" src="../snippet.js"></script><title>NetworkInformation API</title>
</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::NetworkInformation">
http://tizen.org/privilege/telephony
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function checkConnection() {
- var networkState = navigator.connection.type;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function checkConnection()
+{
+ var networkState = navigator.connection.type;
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
- alert('Connection type: ' + states[networkState]);
- }
+ var states = {};
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+ alert('Connection type: ' + states[networkState]);
+}
- checkConnection();
- </pre>
+checkConnection();
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>Connection type: Cell 3G connection
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.UNKNOWN);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.UNKNOWN);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>unknown
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.ETHERNET);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.ETHERNET);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>ethernet
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.WIFI);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.WIFI);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>wifi
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_2G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_2G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>2g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_3G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_3G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>3g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL_4G);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL_4G);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>4g
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.CELL);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.CELL);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>cellular
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(Connection.NONE);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(Connection.NONE);</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre>none
Original documentation: <a href="https://www.npmjs.com/package/cordova-plugin-network-information#online">Cordova online event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- document.addEventListener('online', onOnline, false);
- }
+function onDeviceReady()
+{
+ document.addEventListener('online', onOnline, false);
+}
- function onOnline() {
- // Handle the online event
- }
- </pre>
+function onOnline()
+{
+ /* Handle the online event */
+}
+</pre>
</div>
</div>
<div class="interface" id="OfflineEventCallback">
Original documentation: <a href="https://www.npmjs.com/package/cordova-plugin-network-information#offline">Cordova offline event</a> </p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> document.addEventListener('deviceready', onDeviceReady, false);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+document.addEventListener('deviceready', onDeviceReady, false);
- function onDeviceReady() {
- document.addEventListener('offline', onOffline, false);
- }
+function onDeviceReady()
+{
+ document.addEventListener('offline', onOffline, false);
+}
- function onOffline() {
- // Handle the offline event
- }
- </pre>
+function onOffline()
+{
+ /* Handle the offline event */
+}
+</pre>
</div>
</div>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //The data provider, a native application, should be pre-installed and launched.
- //The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer).
- //In this example, the DictionaryDataControlProvider native sample application is used as a data control provider.
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/*
+ The data provider, a native application, should be pre-installed and launched
+ The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer)
+ In this example, the DictionaryDataControlProvider native sample application is used as a data control provider
+*/
- //Gets SQL type DataControlConsumerObject
- try {
- var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- // Gets MAP type DataControlConsumerObject
- try {
- globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+/* Gets SQL type DataControlConsumerObject */
+try
+{
+ var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
+}
+catch (err)
+{
+ console.log(err.name +": " + err.message);
+}
+/* Gets MAP type DataControlConsumerObject */
+try
+{
+ globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
+}
+catch (err)
+{
+ console.log(err.name +": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id, insertRowId)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id, insertRowId)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- var rowData = {
- columns : ["WORD", "WORD_DESC"] ,
- values : ["'tizen1'", "'tizen2'"]
- };
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'tizen2'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- var rowData = {
- columns : ["WORD", "WORD_DESC"] ,
- values : ["'tizen1'", "'Web apps platform!'"]
- };
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'Web apps platform!'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SQLDataControlConsumer::select">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function getValueSuccessCB(result, id)
- {
- console.log("getValueSuccessCB result.length: " + result.length);
- var length = result.length;
- for (var i = 0; i < length; i++)
- {
- var rowData = "| ";
- var j = 0;
- for (j = 0; j < result[i].columns.length; j++)
- {
- rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
- }
- console.log(rowData);
- }
- }
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function getValueSuccessCB(result, id)
+{
+ console.log("getValueSuccessCB result.length: " + result.length);
+ var length = result.length;
+ for (var i = 0; i < length; i++)
+ {
+ var rowData = "| ";
+ var j = 0;
+ for (j = 0; j < result[i].columns.length; j++)
+ {
+ rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
+ }
+ console.log(rowData);
+ }
+}
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // globalSQLConsumer and globalReqId should be defined before.
- // Increases globalReqId for uniqueness
- globalReqId++;
- var columns = ["WORD", "WORD_DESC" ];
- var whereClause = "1";
- console.log("----- Calling for ascending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC ASC");
- setTimeout( function() {
- console.log("----- Calling descending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC DESC");
- }, 1000);
- }
- catch (err) {
- console.log (err.name +": " + err.message);
- }
-
- </pre>
+try
+{
+ /* globalSQLConsumer and globalReqId should be defined before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ var columns = ["WORD", "WORD_DESC"];
+ var whereClause = "1";
+ console.log("----- Calling for ascending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC ASC");
+ setTimeout(function()
+ {
+ console.log("----- Calling descending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC DESC");
+ }, 1000);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::removeValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::getValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function getValueSuccessCB(result, id)
- {
- console.log(result.length + ":" + result[0]);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function getValueSuccessCB(result, id)
+{
+ console.log(result.length + ":" + result[0]);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MappedDataControlConsumer::updateValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successcb(id)
- {
- console.log("ok : reqid " + id);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successcb(id)
+{
+ console.log("ok: reqid " + id);
+}
- function errorcb(id, error)
- {
- console.log("error id : " + id + ", error msg : " + error.message);
- }
+function errorcb(id, error)
+{
+ console.log("error id: " + id + ", error msg: " + error.message);
+}
- try {
- // Defines globalReqId before
- // Increases globalReqId for uniqueness
- globalReqId++;
- globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
- } catch (err) {
- console.log (err.name +": " + err.message);
- }
- </pre>
+try
+{
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
2.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var req = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt");
- req.httpHeader["Pragma"] = "no-cache";
- req.httpHeader["Cookie"] = "version=1; Skin=new";
- req.httpHeader["X-Agent"] = "Tizen Sample App";
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var req = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt");
+req.httpHeader["Pragma"] = "no-cache";
+req.httpHeader["Cookie"] = "version=1; Skin=new";
+req.httpHeader["X-Agent"] = "Tizen Sample App";
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Check if Download API is supported not on a device.
- var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
- if (download_api_capability === false) {
- console.log("Download API is not supported on this device.");
- return;
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Check whether Download API is supported on a device */
+var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
+if (download_api_capability === false)
+{
+ console.log("Download API is not supported on this device.");
- var listener = {
- onprogress: function(id, receivedSize, totalSize) {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id) {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id) {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, path) {
- console.log('Completed with id: ' + id + ', path: ' + path);
- },
- onfailed: function(id, error) {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
- };
+ return;
+}
- // Starts downloading the file from the Web with the corresponding callbacks.
- var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
- var downloadId = tizen.download.start(downloadRequest, listener);
+var listener =
+{
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, path)
+ {
+ console.log('Completed with id: ' + id + ', path: ' + path);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
+};
- // If you want to download a large file through Wi-Fi,
- var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
- var wifiDownloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
+/* Starts downloading the file from the Web with the corresponding callbacks */
+var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
+var downloadId = tizen.download.start(downloadRequest, listener);
- if (wifi_capability === true) {
- var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
- } else {
- // If you call tizen.download.start(), NotSupportedError will be thrown.
- console.log("This device doesn't support Download API through Wi-Fi.");
- }
+/* If you want to download a large file through Wi-Fi */
+var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
+var wifiDownloadRequest = new tizen.DownloadRequest(
+ "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
- </pre>
+if (wifi_capability === true)
+{
+ var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
+}
+else
+{
+ /* If you call tizen.download.start(), NotSupportedError will be thrown */
+ console.log("This device doesn't support Download API through Wi-Fi.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::cancel">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Cancels the ongoing download operation with the specified ID.
- tizen.download.cancel(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Cancels the ongoing download operation with the specified ID */
+tizen.download.cancel(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::pause">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Pauses the ongoing download operation with the specified ID.
- tizen.download.pause(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Pauses the ongoing download operation with the specified ID */
+tizen.download.pause(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::resume">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Resumes the paused download operation with the specified ID.
- tizen.download.resume(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Resumes the paused download operation with the specified ID */
+tizen.download.resume(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getState">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the state of the download operation with the given ID.
- var state = tizen.download.getState(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the state of the download operation with the given ID */
+var state = tizen.download.getState(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getDownloadRequest">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the download request information with the given ID.
- var downloadRequest = tizen.download.getDownloadRequest(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the download request information with the given ID */
+var downloadRequest = tizen.download.getDownloadRequest(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::getMIMEType">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Get the MIME type of the download operation with the given ID.
- var MIMEtype = tizen.download.getMIMEType(downloadId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Get the MIME type of the download operation with the given ID */
+var MIMEtype = tizen.download.getMIMEType(downloadId);
+</pre>
</div>
</dd>
<dt class="method" id="DownloadManager::setListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- onprogress: function(id, receivedSize, totalSize) {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id) {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id) {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, fileName) {
- console.log('Completed with id: ' + id + ', file name: ' + fileName);
- },
- onfailed: function(id, error) {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, fileName)
+ {
+ console.log('Completed with id: ' + id + ', file name: ' + fileName);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
+};
- // Start downloading the html file on the web with the corresponding callbacks.
- var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
- downloadId = tizen.download.start(downloadRequest);
+/* Start downloading the html file on the web with the corresponding callbacks */
+var downloadRequest = new tizen.DownloadRequest("http://download.tizen.org/tools/README.txt", "documents");
+downloadId = tizen.download.start(downloadRequest);
- // Add the listener.
- tizen.download.setListener(downloadId, listener);
- </pre>
+/* Add the listener */
+tizen.download.setListener(downloadId, listener);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSuccess(exifInfo) {
- console.log("success to get Exif information object");
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occurred: " + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSuccess(exifInfo)
+{
+ console.log("success to get Exif information object");
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
<dt class="method" id="ExifManager::saveExifInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSaveSuccess() {
- console.log("success to save Exif information");
- }
-
- // Defines error callback
- function onSaveError(error) {
- console.log("error occur" + error.name);
- }
-
- // Defines success callback
- function onSuccess(exifInfo) {
- console.log("success to get Exif information object");
- exifInfo.orientation = "ROTATE_90";
- tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occur" + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
-
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSaveSuccess()
+{
+ console.log("success to save Exif information");
+}
+
+/* Defines error callback */
+function onSaveError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+/* Defines success callback */
+function onSuccess(exifInfo)
+{
+ console.log("success to get Exif information object");
+ exifInfo.orientation = "ROTATE_90";
+ tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
<dt class="method" id="ExifManager::getThumbnail">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //Preconditions: please provide images/tizen.jpg file with present Exif data
-
- // Defines success callback
- function onSuccess(thumbData) {
- console.log("got thumbnail data of JPEG file");
- if (thumbData) {
- var img = new Image();
- img.src = thumbData;
- document.body.appendChild(img);
- }
- }
-
- // Defines error callback
- function onError(error) {
- console.log("error occur" + error.name);
- }
-
- function resolveSuccess(file) {
- tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
- }
-
- function resolveFail(error) {
- console.log("error occurred: " + error.name);
- }
-
- tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Preconditions: provide images/tizen.jpg file with present Exif data */
+
+/* Defines success callback */
+function onSuccess(thumbData)
+{
+ console.log("got thumbnail data of JPEG file");
+ if (thumbData)
+ {
+ var img = new Image();
+ img.src = thumbData;
+ document.body.appendChild(img);
+ }
+}
+
+/* Defines error callback */
+function onError(error)
+{
+ console.log("error occur" + error.name);
+}
+
+function resolveSuccess(file)
+{
+ tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
+}
+
+function resolveFail(error)
+{
+ console.log("error occurred: " + error.name);
+}
+
+tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
- } catch (err) {
- console.log (err.name +': ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
+}
+catch (err)
+{
+ console.log(err.name + ': ' + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FeedbackManager::stop">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
- tizen.feedback.stop();
- } catch (err) {
- console.log (err.name +': ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
+ tizen.feedback.stop();
+}
+catch (err)
+{
+ console.log(err.name + ': ' + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="FeedbackManager::isPatternSupported">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var pattern = "BT_CONNECTED", type = "TYPE_SOUND";
- var isPatternSupported = tizen.feedback.isPatternSupported(pattern, type);
- var isSupported = "";
- if(!isPatternSupported) {
- isSupported = " not";
- }
- console.log("pattern " + pattern + " is" + isSupported + " supported");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var pattern = "BT_CONNECTED", type = "TYPE_SOUND";
+var isPatternSupported = tizen.feedback.isPatternSupported(pattern, type);
+var isSupported = "";
+if (!isPatternSupported)
+{
+ isSupported = " not";
+}
+console.log("pattern " + pattern + " is" + isSupported + " supported");
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> pattern BT_CONNECTED is supported
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- }
-
- var testFile = documentsDir.createFile("test.txt");
-
- if (testFile != null) {
- testFile.openStream(
- "w",
- function(fs) {
- fs.write("HelloWorld");
- fs.close();
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
+</pre>
</div>
</li></ul>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.filesystem.resolve(
- 'images',
- function(dir) {
- console.log("Mount point Name is " + dir.path);
- }, function(e) {
- console.log("Error: " + e.message);
- }, "r"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.filesystem.resolve('images', function(dir)
+{
+ console.log("Mount point Name is " + dir.path);
+}, function(e)
+{
+ console.log("Error: " + e.message);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::getStorage">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onStorage(storage) {
- // Do something
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onStorage(storage)
+{
+ /* Do something */
+}
- function onStorageError(e) {
- console.log("Storage not found!" + e.message);
- }
+function onStorageError(e)
+{
+ console.log("Storage not found!" + e.message);
+}
- tizen.filesystem.getStorage("music", onStorage, onStorageError);
- </pre>
+tizen.filesystem.getStorage("music", onStorage, onStorageError);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::listStorages">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function alertForCorruptedRemovableDrives(storages) {
- for (var i = 0; i < storages.length; i++) {
- if (storages[i].type != "EXTERNAL")
- continue;
- if (storages[i].state == "UNMOUNTABLE")
- console.log("External drive " + storages[i].label + " is corrupted.");
- }
- }
-
- tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function alertForCorruptedRemovableDrives(storages)
+{
+ for (var i = 0; i < storages.length; i++)
+ {
+ if (storages[i].type != "EXTERNAL")
+ continue;
+ if (storages[i].state == "UNMOUNTABLE")
+ console.log("External drive " + storages[i].label + " is corrupted.");
+ }
+}
+
+tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::addStorageStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watchID;
- function onStorageStateChanged(storage) {
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watchID;
+function onStorageStateChanged(storage)
+{
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+}
- watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
- </pre>
+watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
+</pre>
</div>
</dd>
<dt class="method" id="FileSystemManager::removeStorageStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watchID;
- function onStorageStateChanged(storage) {
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- tizen.filesystem.removeStorageStateChangeListener(watchID);
- }
-
- watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watchID;
+function onStorageStateChanged(storage)
+{
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+ tizen.filesystem.removeStorageStateChangeListener(watchID);
+}
+
+watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- // alerts each name of dir's contents
- console.log(files[i].name);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
-
- // list directory contents
- dir.listFiles(onsuccess, onerror);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ /* Alerts each name of dir's contents */
+ console.log(files[i].name);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+
+/* List directory contents */
+dir.listFiles(onsuccess, onerror);
+</pre>
</div>
<div class="attributes">
<h4>Attributes</h4>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // list directory contents
- dir.listFiles(onsuccess, onerror);
-
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- // prints the file parent, should contain the
- // same value for all the files in the loop
- console.log("All the files should have the same parent " +
- files[i].parent);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* List directory contents */
+dir.listFiles(onsuccess, onerror);
+
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ /*
+ Prints the file parent, must contain the
+ same value for all the files in the loop
+ */
+ console.log("All the files should have the same parent " +
+ files[i].parent);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+</pre>
</div>
</li>
<li class="attribute" id="File::readOnly">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // lists directory contents
- dir.listFiles(onsuccess, onerror);
-
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].readOnly)
- console.log("Cannot write to file " + files[i].name);
- else
- console.log("Can write to file " + files[i].name);
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Lists directory contents */
+dir.listFiles(onsuccess, onerror);
+
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].readOnly)
+ console.log("Cannot write to file " + files[i].name);
+ else
+ console.log("Can write to file " + files[i].name);
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+</pre>
</div>
</li>
<li class="attribute" id="File::isFile">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(file.modified); // displays the modification timestamp
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(file.modified); /* Displays the modification timestamp */</pre>
</div>
</li>
<li class="attribute" id="File::path">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(file.path); // should be 'music/' if the file is music/foo.mp3
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">console.log(file.path); /* Must be 'music/' if the file is music/foo.mp3 */</pre>
</div>
</li>
<li class="attribute" id="File::name">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // should be foo.mp3 if the file path is music/foo.mp3
- console.log(file.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Must be foo.mp3 if the file path is music/foo.mp3 */
+console.log(file.name);
+</pre>
</div>
</li>
<li class="attribute" id="File::fullPath">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // should be music/track1.mp3 if the file is music/track1.mp3
- console.log(file.fullPath);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Must be music/track1.mp3 if the file is music/track1.mp3 */
+console.log(file.fullPath);
+</pre>
</div>
</li>
<li class="attribute" id="File::fileSize">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // displays the file size
- console.log(file.fileSize);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Displays the file size */
+console.log(file.fileSize);
+</pre>
</div>
</li>
<li class="attribute" id="File::length">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // '3' if the directory contains two files and one sub-directory
- console.log(file.length);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* '3' if the directory contains two files and one sub-directory */
+console.log(file.length);
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file) {
- var audio = new Audio(file.toURI());
- audio.play();
- console.log(file.toURI());
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
+{
+ var audio = new Audio(file.toURI());
+ audio.play();
+ console.log(file.toURI());
+});
+</pre>
</div>
</dd>
<dt class="method" id="File::listFiles">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- console.log("There are " + files.length + " in the selected folder");
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- "documents",
- function(dir) {
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error " + e.message);
- }, "r"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ console.log("There are " + files.length + " in the selected folder");
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve("documents", function(dir)
+{
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error " + e.message);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="File::openStream">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- }
-
- var testFile = documentsDir.createFile("test.txt");
- if (testFile != null) {
- testFile.openStream(
- "w",
- function(fs) {
- fs.write("HelloWorld");
- fs.close();
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir; dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::readAsText">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- console.log("File Name is " + files[i].name); // displays file name
- if (files[i].isDirectory == false)
- files[i].readAsText(
- function(str) {
- console.log("The file content " + str);
- }, function(e) {
- console.log("Error " + e.message);
- }, "UTF-8"
- );
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- var documentsDir;
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ if (files[i].isDirectory == false)
+ {
+ files[i].readAsText(function(str)
+ {
+ console.log("The file content " + str);
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+var documentsDir;
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::copyTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory == false) {
- documentsDir.copyTo(files[i].fullPath,
- "images/backup/" + files[i].name,
- false,
- function() {console.log("file copied");});
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.copyTo(files[i].fullPath,
+ "images/backup/" + files[i].name, false,
+ function() {console.log("file copied");});
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::moveTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory == false) {
- documentsDir.moveTo(files[i].fullPath,
- "images/newFolder/" + files[i].name,
- false,
- function() {console.log("file moved");});
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message +
- " occurred during listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.moveTo(files[i].fullPath,
+ "images/newFolder/" + files[i].name, false,
+ function() {console.log("file moved");});
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message +
+ " occurred during listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::createDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var dir; //Directory object obtained from filesystem API
- var newDir = dir.createDirectory("newDir");
- var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var dir; /* Directory object obtained from filesystem API */
+var newDir = dir.createDirectory("newDir");
+var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
+</pre>
</div>
</dd>
<dt class="method" id="File::createFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var newFile = dir.createFile("newFilePath");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">var newFile = dir.createFile("newFilePath");</pre>
</div>
</dd>
<dt class="method" id="File::resolve">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var file;
- // Resolves helloWorld.doc file that is located in the
- // documents root location
- tizen.filesystem.resolve(
- 'documents',
- function(dir) { file = dir.resolve("helloWorld.doc");},
- function(e) { console.log("Error" + e.message);},
- "rw");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var file;
+/*
+ Resolves helloWorld.doc file that is located in the
+ documents root location
+*/
+tizen.filesystem.resolve('documents', function(dir)
+{
+ file = dir.resolve("helloWorld.doc");
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::deleteDirectory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var documentsDir;
- function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (files[i].isDirectory) {
- documentsDir.deleteDirectory(
- files[i].fullPath,
- false,
- function() {
- console.log("Directory Deleted");
- }, function(e) {
- console.log("Error" + e.message);
- });
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var documentsDir;
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory)
+ {
+ documentsDir.deleteDirectory(files[i].fullPath, false, function()
+ {
+ console.log("Directory Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
<dt class="method" id="File::deleteFile">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccess(files) {
- for (var i = 0; i < files.length; i++) {
- if (!files[i].isDirectory) {
- documentsDir.deleteFile(
- files[i].fullPath,
- function() {
- console.log("File Deleted");
- }, function(e) {
- console.log("Error" + e.message);
- });
- }
- }
- }
-
- function onerror(error) {
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
- }
-
- var documentsDir;
- tizen.filesystem.resolve(
- 'documents',
- function(dir) {
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
- }, function(e) {
- console.log("Error" + e.message);
- }, "rw"
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccess(files)
+{
+ for (var i = 0; i < files.length; i++)
+ {
+ if (!files[i].isDirectory)
+ {
+ documentsDir.deleteFile(files[i].fullPath, function()
+ {
+ console.log("File Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
+}
+
+function onerror(error)
+{
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+}
+
+var documentsDir;
+tizen.filesystem.resolve('documents', function(dir)
+{
+ documentsDir = dir;
+ dir.listFiles(onsuccess,onerror);
+}, function(e)
+{
+ console.log("Error" + e.message);
+}, "rw");
+</pre>
</div>
</dd>
</dl>
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> if (stream.eof) {
- // file has been read completely
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+if (stream.eof)
+{
+ /* File has been read completely */
+}
+</pre>
</div>
</li>
<li class="attribute" id="FileStream::position">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(stream.position); // displays current stream position
- // alters current stream position to the begin of the file,
- // like seek() in C
- stream.position = 0;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(stream.position); /* Displays current stream position */
+/*
+ Alters current stream position to the begin of the file,
+ like seek() in C
+*/
+stream.position = 0;
+</pre>
</div>
</li>
<li class="attribute" id="FileStream::bytesAvailable">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log(stream.bytesAvailable); // displays the available bytes to be read
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log(stream.bytesAvailable); /* Displays the available bytes to be read */</pre>
</div>
</li>
</ul>
http://tizen.org/privilege/filesystem.read
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> stream.close(); // closes this stream, no subsequent access to stream allowed
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+stream.close(); /* Closes this stream, no subsequent access to stream allowed */
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::read">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var text = stream.read(file.fileSize);
- stream.close();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var text = stream.read(file.fileSize);
+stream.close();
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::readBytes">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // reads up to 256 bytes from the stream
- var raw = stream.readBytes(256);
- for (var i = 0; i < raw.length; i++) {
- // raw[i] contains the i-th byte of the current data chunk
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Reads up to 256 bytes from the stream */
+var raw = stream.readBytes(256);
+for (var i = 0; i < raw.length; i++)
+{
+ /* raw[i] contains the i-th byte of the current data chunk */
+}
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::readBase64">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // reads up to 256 bytes from the stream
- var base64 = stream.readBase64(256);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Reads up to 256 bytes from the stream */
+var base64 = stream.readBase64(256);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::write">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var text = "Hello world";
- stream.write(text);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var text = "Hello world";
+stream.write(text);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::writeBytes">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var bytes = in.readBytes(256);
- // writes the bytes read from in to out
- out.writeBytes(bytes);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var bytes = in.readBytes(256);
+/* Writes the bytes read from in to out */
+out.writeBytes(bytes);
+</pre>
</div>
</dd>
<dt class="method" id="FileStream::writeBase64">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var base64 = in.readBase64(256);
- // writes the base64 data read from in to out
- out.writeBase64(base64);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var base64 = in.readBase64(256);
+/* Writes the base64 data read from in to out */
+out.writeBase64(base64);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onchangedCB(sleepInfo) {
- console.log("Sleep status : " + sleepInfo.status);
- console.log("Timestamp : " + sleepInfo.timestamp);
- }
-
- tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onchangedCB(sleepInfo)
+{
+ console.log("Sleep status: " + sleepInfo.status);
+ console.log("Timestamp: " + sleepInfo.timestamp);
+}
+
+tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre> Sleep status : ASLEEP
- Timestamp : 1456735296123
+<span class="title"><p>Output example:</p></span><pre> Sleep status: ASLEEP
+ Timestamp: 1456735296123
</pre>
</div>
</div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onsuccessCB(pedometerInfo) {
- console.log("Step status : " + pedometerInfo.stepStatus);
- console.log("Cumulative total step count : " + pedometerInfo.cumulativeTotalStepCount);
- }
-
- function onerrorCB(error) {
- console.log("Error occurs. name:"+error.name + ", message: "+error.message);
- }
-
- function onchangedCB(pedometerdata) {
- console.log("From now on, you will be notified when the pedometer data changes.");
- // To get the current data information
- tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
- }
-
- tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onsuccessCB(pedometerInfo)
+{
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
+}
+
+function onerrorCB(error)
+{
+ console.log("Error occurs. name:" + error.name + ", message: " + error.message);
+}
+
+function onchangedCB(pedometerdata)
+{
+ console.log("From now on, you will be notified when the pedometer data changes.");
+ /* To get the current data information */
+ tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
+}
+
+tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> From now on, you will be notified when the pedometer data changes.
- Step status : WALKING
- Cumulative total step count : 100
+ Step status: WALKING
+ Cumulative total step count: 100
</pre>
</div>
</dd>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onchangedCB(pedometerInfo) {
- console.log("Step status : " + pedometerInfo.stepStatus);
- console.log("Cumulative total step count : " + pedometerInfo.cumulativeTotalStepCount);
- }
-
- tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onchangedCB(pedometerInfo)
+{
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
+}
+
+tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre> Step status : WALKING
- Cumulative total step count : 100
+<span class="title"><p>Output example:</p></span><pre> Step status: WALKING
+ Cumulative total step count: 100
</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onchangedCB(info) {
- var gpsInfo = info.gpsInfo;
- for (var index = 0; index < gpsInfo.length; index++) {
- console.log("latitude: " + gpsInfo[index].latitude);
- console.log("longitude: " + gpsInfo[index].longitude);
- }
- }
-
- function onerrorCB(error) {
- console.log("Error occurred. Name:" + error.name + ", message: " + error.message);
- }
-
- try {
- tizen.humanactivitymonitor.start("GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000});
- } catch(err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onchangedCB(info)
+{
+ var gpsInfo = info.gpsInfo;
+ for (var index = 0; index < gpsInfo.length; index++)
+ {
+ console.log("latitude: " + gpsInfo[index].latitude);
+ console.log("longitude: " + gpsInfo[index].longitude);
+ }
+}
+
+function onerrorCB(error)
+{
+ console.log("Error occurred. Name:" + error.name + ", message: " + error.message);
+}
+
+try
+{
+ tizen.humanactivitymonitor.start("GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000});
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="HumanActivityMonitorManager::stop">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.humanactivitymonitor.stop("PEDOMETER");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.humanactivitymonitor.stop("PEDOMETER");
+</pre>
</div>
</dd>
<dt class="method" id="HumanActivityMonitorManager::setAccumulativePedometerListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onchangedCB(pedometerInfo) {
- console.log("Step status : " + pedometerInfo.stepStatus);
- console.log("Accumulative total step count : " + pedometerInfo.accumulativeTotalStepCount);
- }
-
- tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onchangedCB(pedometerInfo)
+{
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount);
+}
+
+tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
+</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre> Step status : WALKING
- Accumulative total step count : 100
+<span class="title"><p>Output example:</p></span><pre> Step status: WALKING
+ Accumulative total step count: 100
</pre>
</div>
</dd>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
+</pre>
</div>
</dd>
<dt class="method" id="HumanActivityMonitorManager::addActivityRecognitionListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCallback(error) {
- console.log (error.name +': ' + error.message);
- }
-
- function listener(info) {
- console.log('type: ' + info.type);
- console.log('timestamp: ' + info.timestamp);
- console.log('accuracy: ' + info.accuracy);
- }
-
- try {
- var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
- } catch (error) {
- console.log (error.name +': ' + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCallback(error)
+{
+ console.log(error.name + ': ' + error.message);
+}
+
+function listener(info)
+{
+ console.log('type: ' + info.type);
+ console.log('timestamp: ' + info.timestamp);
+ console.log('accuracy: ' + info.accuracy);
+}
+
+try
+{
+ var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
+}
+catch (error)
+{
+ console.log(error.name + ': ' + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> type: WALKING
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listenerId;
-
- function errorCallback(error) {
- console.log (error.name +': ' + error.message);
- }
-
- function listener(info) {
- console.log('type: ' + info.type);
- console.log('timestamp: ' + info.timestamp);
- console.log('accuracy: ' + info.accuracy);
-
- tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback);
- }
-
- try {
- listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
- } catch (error) {
- console.log (error.name +': ' + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listenerId;
+
+function errorCallback(error)
+{
+ console.log(error.name + ': ' + error.message);
+}
+
+function listener(info)
+{
+ console.log('type: ' + info.type);
+ console.log('timestamp: ' + info.timestamp);
+ console.log('accuracy: ' + info.accuracy);
+
+ tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback);
+}
+
+try
+{
+ listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
+}
+catch (error)
+{
+ console.log(error.name + ': ' + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> type: WALKING
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var i, keyCode = {}, supportedKeys;
- supportedKeys = tizen.inputdevice.getSupportedKeys();
- for (i = 0; i < supportedKeys.length; i++) {
- keyCode[supportedKeys[i].name] = supportedKeys[i].code;
- }
- if(keyCode.hasOwnProperty("VolumeUp")) {
- tizen.inputdevice.registerKey("VolumeUp");
- }
- window.addEventListener("keydown", function(keyEvent) {
- // identify the key by the numeric code from the keyEvent
- if(keyEvent.keyCode === keyCode.VolumeUp) {
- console.log("The VOLUME UP was pressed");
- }
- });
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var i, keyCode = {}, supportedKeys;
+supportedKeys = tizen.inputdevice.getSupportedKeys();
+for (i = 0; i < supportedKeys.length; i++)
+{
+ keyCode[supportedKeys[i].name] = supportedKeys[i].code;
+}
+if (keyCode.hasOwnProperty("VolumeUp"))
+{
+ tizen.inputdevice.registerKey("VolumeUp");
+}
+window.addEventListener("keydown", function(keyEvent)
+{
+ /* Identify the key by the numeric code from the keyEvent */
+ if (keyEvent.keyCode === keyCode.VolumeUp)
+ {
+ console.log("The VOLUME UP was pressed");
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="InputDeviceManager::getKey">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var keys = ["VolumeUp", "VolumeDown"], i;
- for (i = 0; i < keys.length; i++) {
- try {
- tizen.inputdevice.registerKey(keys[i]);
- } catch(error) {
- console.log("failed to register " + keys[i] + ": " + error);
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var keys = ["VolumeUp", "VolumeDown"], i;
+for (i = 0; i < keys.length; i++)
+{
+ try
+ {
+ tizen.inputdevice.registerKey(keys[i]);
+ }
+ catch (error)
+ {
+ console.log("failed to register " + keys[i] + ": " + error);
+ }
+}
+</pre>
</div>
</dd>
<dt class="method" id="InputDeviceManager::unregisterKey">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.inputdevice.unregisterKey("VolumeDown");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.inputdevice.unregisterKey("VolumeDown");
+</pre>
</div>
</dd>
<dt class="method" id="InputDeviceManager::registerKeyBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function successCB() {
- console.log('Registsered successfully');
- }
+function successCB()
+{
+ console.log('Registered successfully');
+}
- var keys = ["VolumeUp", "VolumeDown"];
- tizen.inputdevice.registerKeyBatch(keys, successCB, errorCB);
- </pre>
+var keys = ["VolumeUp", "VolumeDown"];
+tizen.inputdevice.registerKeyBatch(keys, successCB, errorCB);
+</pre>
</div>
</dd>
<dt class="method" id="InputDeviceManager::unregisterKeyBatch">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function errorCB(err) {
- console.log( 'The following error occurred: ' + err.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
+
+function successCB()
+{
+ console.log('Unregistsered successfully');
+}
- function successCB() {
- console.log('Unregistsered successfully');
- }
- var keys = ["VolumeUp", "VolumeDown"];
- tizen.inputdevice.unregisterKeyBatch(keys, successCB, errorCB);
- </pre>
+var keys = ["VolumeUp", "VolumeDown"];
+tizen.inputdevice.unregisterKeyBatch(keys, successCB, errorCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
- function onSave() {
- console.log("Successfully saved data");
- }
+function onSave()
+{
+ console.log("Successfully saved data");
+}
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::removeData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onSave() {
-
- // do something
-
- // Dictionary does not require package ID because the
- // application which is calling removeData() saved "data1"
- tizen.keymanager.removeData({
- "name": data_name
- });
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onSave()
+{
+ /* Do something */
+
+ /*
+ Dictionary does not require package ID because the
+ application which is calling removeData() saved "data1"
+ */
+ tizen.keymanager.removeData({"name": data_name});
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- if (aliases.length != 0) {
- // Assuming the application calling removeData() has permission
- // to remove aliases[0]
- var app_data = tizen.keymanager.removeData(aliases[0]);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+if (aliases.length != 0)
+{
+ /*
+ Assuming the application calling removeData() has permission
+ to remove aliases[0]
+ */
+ var app_data = tizen.keymanager.removeData(aliases[0]);
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::getData">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onSave() {
- // Dictionary does not require package ID because the
- // application which is calling getData() saved "data1"
- var app_data = tizen.keymanager.getData({
- "name": data_name
- });
- console.log("App data: " + app_data + " was retrieved");
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onSave()
+{
+ /*
+ Dictionary does not require package ID because the
+ application which is calling getData() saved "data1"
+ */
+ var app_data = tizen.keymanager.getData({"name": data_name});
+ console.log("App data: " + app_data + " was retrieved");
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- if (aliases.length != 0) {
- // Assuming the application calling getData() has permission to read
- // aliases[0]
- var app_data = tizen.keymanager.getData(aliases[0]);
- console.log("App data: " + app_data + " was retrieved");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+if (aliases.length != 0)
+{
+ /*
+ Assuming the application calling getData() has permission to read
+ aliases[0]
+ */
+ var app_data = tizen.keymanager.getData(aliases[0]);
+ console.log("App data: " + app_data + " was retrieved");
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::getDataAliasList">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- console.log("aliases: ");
- for (var i = 0; i < aliases.length; i++) {
- console.log("Package ID: " + aliases[i].packageId + ", Name: "
- + aliases[i].name);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+console.log("aliases: ");
+for (var i = 0; i < aliases.length; i++)
+{
+ console.log("Package ID: " + aliases[i].packageId + ", Name: "
+ + aliases[i].name);
+}
+</pre>
</div>
</dd>
<dt class="method" id="KeyManager::setPermission">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var data_name = "data1", raw_data = "my data";
-
- function onPermissionSet() {
- console.log("Successfully set permssion");
- }
-
- function onSave() {
- // Dictionary does not require package ID because an
- // application can only set permission for data which it saved
- tizen.keymanager.setPermission({
- "name": data_name
- }, "9PdoiICQ4c", "READ_REMOVE", onPermissionSet);
- }
-
- tizen.keymanager.saveData(data_name, raw_data, null, onSave);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var data_name = "data1", raw_data = "my data";
+
+function onPermissionSet()
+{
+ console.log("Successfully set permission");
+}
+
+function onSave()
+{
+ /*
+ Dictionary does not require package ID because an
+ application can only set permission for data which it saved
+ */
+ tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+}
+
+tizen.keymanager.saveData(data_name, raw_data, null, onSave);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var aliases = tizen.keymanager.getDataAliasList();
-
- function onPermissionSet() {
- console.log("Successfully set permssion");
- }
-
- if (aliases.length != 0) {
- // Check that the application calling setPermission() saved aliases[0] into
- // the KeyManager
- if (aliases[0].packageId === tizen.package.getPackageInfo().id) {
- tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
- } else {
- console.log("This application did not save aliases[0] into the KeyManager");
- }
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var aliases = tizen.keymanager.getDataAliasList();
+
+function onPermissionSet()
+{
+ console.log("Successfully set permssion");
+}
+
+if (aliases.length != 0)
+{
+ /*
+ Check that the application calling setPermission() saved aliases[0] into
+ the KeyManager
+ */
+ if (aliases[0].packageId === tizen.package.getPackageInfo().id)
+ {
+ tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+ }
+ else
+ {
+ console.log("This application did not save aliases[0] into the KeyManager");
+ }
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var mcClient = tizen.mediacontroller.getClient();
- } catch (err) {
- console.log (err.name +': ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var mcClient = tizen.mediacontroller.getClient();
+}
+catch (err)
+{
+ console.log(err.name + ': ' + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerManager::createServer">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var mcServer = tizen.mediacontroller.createServer();
- } catch (err) {
- console.log (err.name +': ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var mcServer = tizen.mediacontroller.createServer();
+}
+catch (err)
+{
+ console.log(err.name + ': ' + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
- mcServer.updatePlaybackState('PLAY');
- console.log('Current playback state is: ' + mcServer.playbackInfo.state);
- </pre>
+mcServer.updatePlaybackState('PLAY');
+console.log('Current playback state is: ' + mcServer.playbackInfo.state);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::updatePlaybackPosition">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
- mcServer.updatePlaybackPosition(164);
- console.log('Current playback position is: ' + mcServer.playbackInfo.position);
- </pre>
+mcServer.updatePlaybackPosition(164);
+console.log('Current playback position is: ' + mcServer.playbackInfo.position);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::updateShuffleMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
- mcServer.updateShuffleMode(true);
- console.log('Current shuffle mode is: ' + mcServer.playbackInfo.shuffleMode);
- </pre>
+mcServer.updateShuffleMode(true);
+console.log('Current shuffle mode is: ' + mcServer.playbackInfo.shuffleMode);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::updateRepeatMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
- mcServer.updateRepeatMode(true);
- console.log('Current repeat mode is: ' + mcServer.playbackInfo.repeatMode);
- </pre>
+mcServer.updateRepeatMode(true);
+console.log('Current repeat mode is: ' + mcServer.playbackInfo.repeatMode);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::updateMetadata">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcServer = tizen.mediacontroller.createServer();
- var metadata = mcServer.playbackInfo.metadata;
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcServer = tizen.mediacontroller.createServer();
+var metadata = mcServer.playbackInfo.metadata;
- metadata.artist = 'Artist Name';
- mcServer.updateMetadata(metadata);
+metadata.artist = 'Artist Name';
+mcServer.updateMetadata(metadata);
- console.log('Current metadata is: ' + JSON.stringify(mcServer.playbackInfo.metadata));
- </pre>
+console.log('Current metadata is: ' + JSON.stringify(mcServer.playbackInfo.metadata));
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::addChangeRequestPlaybackInfoListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcServer = tizen.mediacontroller.createServer();
-
- var playbackRequestListener = {
- onplaybackstaterequest: function(state) {
- console.log('Playback state requested to: ' + state);
- },
- onplaybackpositionrequest: function(position) {
- console.log('Playback position requested to: ' + position);
- },
- onshufflemoderequest: function(mode) {
- console.log('Shuffle mode requested to: ' + mode);
- },
- onrepeatmoderequest: function(mode) {
- console.log('Repeat mode requested to: ' + mode);
- }
- };
-
- // Registers to receive playback info change requests from client.
- watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcServer = tizen.mediacontroller.createServer();
+
+var playbackRequestListener =
+{
+ onplaybackstaterequest: function(state)
+ {
+ console.log('Playback state requested to: ' + state);
+ },
+ onplaybackpositionrequest: function(position)
+ {
+ console.log('Playback position requested to: ' + position);
+ },
+ onshufflemoderequest: function(mode)
+ {
+ console.log('Shuffle mode requested to: ' + mode);
+ },
+ onrepeatmoderequest: function(mode)
+ {
+ console.log('Repeat mode requested to: ' + mode);
+ }
+};
+
+/* Registers to receive playback info change requests from client */
+watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::removeChangeRequestPlaybackInfoListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcServer = tizen.mediacontroller.createServer();
-
- var playbackRequestListener = {
- onplaybackstaterequest: function(state) {
- console.log('Playback state requested to: ' + state);
- },
- onplaybackpositionrequest: function(position) {
- console.log('Playback position requested to: ' + position);
- },
- onshufflemoderequest: function(mode) {
- console.log('Shuffle mode requested to: ' + mode);
- },
- onrepeatmoderequest: function(mode) {
- console.log('Repeat mode requested to: ' + mode);
- }
- };
-
- // Registers to receive playback info change requests.
- watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
-
- // Cancels the watch operation.
- mcServer.removeChangeRequestPlaybackInfoListener(watcherId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcServer = tizen.mediacontroller.createServer();
+
+var playbackRequestListener =
+{
+ onplaybackstaterequest: function(state)
+ {
+ console.log('Playback state requested to: ' + state);
+ },
+ onplaybackpositionrequest: function(position)
+ {
+ console.log('Playback position requested to: ' + position);
+ },
+ onshufflemoderequest: function(mode)
+ {
+ console.log('Shuffle mode requested to: ' + mode);
+ },
+ onrepeatmoderequest: function(mode)
+ {
+ console.log('Repeat mode requested to: ' + mode);
+ }
+};
+
+/* Registers to receive playback info change requests */
+watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
+
+/* Cancels the watch operation */
+mcServer.removeChangeRequestPlaybackInfoListener(watcherId);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::addCommandListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcServer = tizen.mediacontroller.createServer();
- var commandReceiveListener = function(clientName, command, data) {
- console.log('Command ' + command + ' received from: ' + clientName +
- ' with data: ' + JSON.stringify(data));
+var commandReceiveListener = function(clientName, command, data)
+{
+ console.log('Command ' + command + ' received from: ' + clientName +
+ ' with data: ' + JSON.stringify(data));
- var reply = {
- myReply: 'someValue'
- };
+ var reply = {myReply: 'someValue'};
- return reply;
- };
+ return reply;
+};
- // Registers to receive custom commands from client.
- watcherId = mcServer.addCommandListener(commandReceiveListener);
- </pre>
+/* Registers to receive custom commands from client */
+watcherId = mcServer.addCommandListener(commandReceiveListener);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServer::removeCommandListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcServer = tizen.mediacontroller.createServer();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcServer = tizen.mediacontroller.createServer();
- var commandReceiveListener = function(clientName, command, data) {
- console.log('Command ' + command + ' received from: ' + clientName +
- ' with data: ' + JSON.stringify(data));
+var commandReceiveListener = function(clientName, command, data)
+{
+ console.log('Command ' + command + ' received from: ' + clientName +
+ ' with data: ' + JSON.stringify(data));
- var reply = {
- myReply: 'someValue'
- };
+ var reply = {myReply: 'someValue'};
- return reply;
- };
+ return reply;
+};
- // Registers to receive custom commands from client.
- watcherId = mcServer.addCommandListener(commandReceiveListener);
+/* Registers to receive custom commands from client */
+watcherId = mcServer.addCommandListener(commandReceiveListener);
- // Cancels the watch operation.
- mcServer.removeCommandListener(watcherId);
- </pre>
+/* Cancels the watch operation */
+mcServer.removeCommandListener(watcherId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Access latest server info
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
- console.log('Latest server name is: ' + mcServerInfo.name +
- ', server state: ' + mcServerInfo.name);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Access latest server info */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+console.log('Latest server name is: ' + mcServerInfo.name +
+ ', server state: ' + mcServerInfo.name);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- mcServerInfo.sendPlaybackState('STOP', function() {
- console.log('Playback has stopped');
- }, function(e) {
- console.log('Unable to change playback state: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+mcServerInfo.sendPlaybackState('STOP', function()
+{
+ console.log('Playback has stopped');
+}, function(e)
+{
+ console.log('Unable to change playback state: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::sendPlaybackPosition">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- mcServerInfo.sendPlaybackPosition(164, function() {
- console.log('Playback position changed');
- }, function(e) {
- console.log('Unable to change playback position: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+mcServerInfo.sendPlaybackPosition(164, function()
+{
+ console.log('Playback position changed');
+}, function(e)
+{
+ console.log('Unable to change playback position: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::sendShuffleMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- mcServerInfo.sendShuffleMode(true, function() {
- console.log('Shuffle mode changed');
- }, function(e) {
- console.log('Unable to change shuffle mode: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+mcServerInfo.sendShuffleMode(true, function()
+{
+ console.log('Shuffle mode changed');
+}, function(e)
+{
+ console.log('Unable to change shuffle mode: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::sendRepeatMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- mcServerInfo.sendRepeatMode(false, function() {
- console.log('Repeat mode changed');
- }, function(e) {
- console.log('Unable to change repeat mode: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+mcServerInfo.sendRepeatMode(false, function()
+{
+ console.log('Repeat mode changed');
+}, function(e)
+{
+ console.log('Unable to change repeat mode: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::sendCommand">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- var exampleCustomCommandData = {
- myFilter: 'rock'
- };
- mcServerInfo.sendCommand('myPlaylistFilter', exampleCustomCommandData, function(response) {
- console.log('Command executed with result: ' + JSON.stringify(response));
- }, function(e) {
- console.log('Error executing command: ' + e.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+var exampleCustomCommandData = {myFilter: 'rock'};
+
+mcServerInfo.sendCommand('myPlaylistFilter', exampleCustomCommandData, function(response)
+{
+ console.log('Command executed with result: ' + JSON.stringify(response));
+}, function(e)
+{
+ console.log('Error executing command: ' + e.message);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::addServerStatusChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- // Registers to be notified when server status changes.
- watcherId = mcServerInfo.addServerStatusChangeListener(function(status) {
- console.log(mcServerInfo.name + ' server status changed to ' + status);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+/* Registers to be notified when server status changes */
+watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
+{
+ console.log(mcServerInfo.name + ' server status changed to ' + status);
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::removeServerStatusChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
- // Registers to be notified when server status changes.
- watcherId = mcServerInfo.addServerStatusChangeListener(function(status) {
- console.log(mcServerInfo.name + ' server status changed to ' + status);
- });
+/* Registers to be notified when server status changes */
+watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
+{
+ console.log(mcServerInfo.name + ' server status changed to ' + status);
+});
- // Cancels the watch operation.
- mcServerInfo.removeServerStatusChangeListener(watcherId);
- </pre>
+/* Cancels the watch operation */
+mcServerInfo.removeServerStatusChangeListener(watcherId);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::addPlaybackInfoChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- var playbackListener = {
- onplaybackchanged: function(state, position) {
- console.log('Current playback state: ' + state);
- console.log('Current playback position: ' + position);
- },
- onshufflemodechanged: function(mode) {
- console.log('Shuffle mode changed to: ' + mode);
- },
- onrepeatmodechanged: function(mode) {
- console.log('Repeat mode changed to: ' + mode);
- },
- onmetadatachanged: function(metadata) {
- console.log('Playback metadata changed: ' + JSON.stringify(metadata));
- }
- };
-
- // Registers to be notified when playback state changes.
- watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+var playbackListener =
+{
+ onplaybackchanged: function(state, position)
+ {
+ console.log('Current playback state: ' + state);
+ console.log('Current playback position: ' + position);
+ },
+ onshufflemodechanged: function(mode)
+ {
+ console.log('Shuffle mode changed to: ' + mode);
+ },
+ onrepeatmodechanged: function(mode)
+ {
+ console.log('Repeat mode changed to: ' + mode);
+ },
+ onmetadatachanged: function(metadata)
+ {
+ console.log('Playback metadata changed: ' + JSON.stringify(metadata));
+ }
+};
+
+/* Registers to be notified when playback state changes */
+watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
+</pre>
</div>
</dd>
<dt class="method" id="MediaControllerServerInfo::removePlaybackInfoChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var watcherId = 0; // watcher identifier
- var mcClient = tizen.mediacontroller.getClient();
- var mcServerInfo = mcClient.getLatestServerInfo();
-
- // receives playback state changes
- var playbackListener = {
- onplaybackchanged: function(state, position) {
- console.log('Current playback state: ' + state);
- console.log('Current playback position: ' + position);
- },
- onshufflemodechanged: function(mode) {
- console.log('Shuffle mode changed to: ' + mode);
- },
- onrepeatmodechanged: function(mode) {
- console.log('Repeat mode changed to: ' + mode);
- },
- onmetadatachanged: function(metadata) {
- console.log('Playback metadata changed: ' + JSON.stringify(metadata));
- }
- };
-
- // Registers to be notified when playback state changes.
- watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
-
- // Cancels the watch operation.
- mcServerInfo.removePlaybackInfoChangeListener(watcherId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var watcherId = 0; /* Watcher identifier */
+var mcClient = tizen.mediacontroller.getClient();
+var mcServerInfo = mcClient.getLatestServerInfo();
+
+/* Receives playback state changes */
+var playbackListener =
+{
+ onplaybackchanged: function(state, position)
+ {
+ console.log('Current playback state: ' + state);
+ console.log('Current playback position: ' + position);
+ },
+ onshufflemodechanged: function(mode)
+ {
+ console.log('Shuffle mode changed to: ' + mode);
+ },
+ onrepeatmodechanged: function(mode)
+ {
+ console.log('Repeat mode changed to: ' + mode);
+ },
+ onmetadatachanged: function(metadata)
+ {
+ console.log('Playback metadata changed: ' + JSON.stringify(metadata));
+ }
+};
+
+/* Registers to be notified when playback state changes */
+watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
+
+/* Cancels the watch operation */
+mcServerInfo.removePlaybackInfoChangeListener(watcherId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.mediakey.setMediaKeyEventListener({
- onpressed: function(key) {
- console.log("Pressed key: " + key);
- },
- onreleased: function(key) {
- console.log("Released key: " + key);
- }
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.mediakey.setMediaKeyEventListener(
+{
+ onpressed: function(key)
+ {
+ console.log("Pressed key: " + key);
+ },
+ onreleased: function(key)
+ {
+ console.log("Released key: " + key);
+ }
+});
+</pre>
</div>
</dd>
<dt class="method" id="MediaKeyManager::unsetMediaKeyEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.mediakey.unsetMediaKeyEventListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.mediakey.unsetMediaKeyEventListener();
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the LocalMessagePort instance with the specified message port name
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the LocalMessagePort instance with the specified message port name */
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestTrustedLocalMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the LocalMessagePort instance with the specified message port name
- var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the LocalMessagePort instance with the specified message port name */
+var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestRemoteMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the RemoteMessagePort instance with the specified message port name
- var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the RemoteMessagePort instance with the specified message port name */
+var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
+</pre>
</div>
</dd>
<dt class="method" id="MessagePortManager::requestTrustedRemoteMessagePort">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests the RemoteMessagePort instance with the specified message port name.
- var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests the RemoteMessagePort instance with the specified message port name */
+var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onreceived(data, remoteMsgPort) {
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onreceived(data, remoteMsgPort)
+{
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+}
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- </pre>
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+</pre>
</div>
</dd>
<dt class="method" id="LocalMessagePort::removeMessagePortListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- // Communication routines of your app...
- localMsgPort.removeMessagePortListener(watchId);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+/* Communication routines of your app */
+
+localMsgPort.removeMessagePortListener(watchId);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sends string message
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
- localMsgPort.addMessagePortListener(function(items, remoteport) {
- // ...
- if(remoteport !== null) {
- remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
- }
- });
- // stream - FileStream object
- var bytePockets = [], byteCount = 0, i = 0;
- while(byteCount stream.bytesAvailable - 256) {
- bytePockets[i] = stream.readBytes(256);
- byteCount+=256;
- i++;
- }
- bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
-
- var messagePortPockets = [{key: "key1", value: "val1"},
- {key: "key2", value: ["val2", "val3", "val4"]},
- {key: "key3", value: bytePockets[0]},
- {key: "key4", value: bytePockets}];
- remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sends string message */
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
+localMsgPort.addMessagePortListener(function(items, remoteport)
+{
+ /* ... */
+ if (remoteport !== null)
+ {
+ remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
+ }
+});
+/* stream - FileStream object */
+var bytePockets = [], byteCount = 0, i = 0;
+while (byteCount < stream.bytesAvailable - 256)
+{
+ bytePockets[i] = stream.readBytes(256);
+ byteCount+=256;
+ i++;
+}
+bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
+
+var messagePortPockets = [{key: "key1", value: "val1"},
+ {key: "key2", value: ["val2", "val3", "val4"]},
+ {key: "key3", value: bytePockets[0]},
+ {key: "key4", value: bytePockets}];
+remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // MessagePortCallback instance
- function onreceived(data, remoteMsgPort) {
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
- }
-
- var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
- var watchId = localMsgPort.addMessagePortListener(onreceived);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* MessagePortCallback instance */
+function onreceived(data, remoteMsgPort)
+{
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+}
+
+var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
+var watchId = localMsgPort.addMessagePortListener(onreceived);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var adapter = tizen.nfc.getDefaultAdapter();
- } catch (err) {
- console.log(err.name +": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var adapter = tizen.nfc.getDefaultAdapter();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCManager::setExclusiveMode">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.nfc.setExclusiveMode(true) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.nfc.setExclusiveMode(true);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gNfcAdapter;
- var onPowerOn = function(){ // Called when NFC adapter is powered on
- try {
- console.log("Power on succeed");
- // Implement NFC communication routines ...
- gNfcAdapter.setPowered(
- false, // Disable NFC adapter
- function () {console.log("Power off succeed"); }, // Handle success
- function () {console.log("Power off failed"); }); // Handle failure
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- };
- try {
- gNfcAdapter = tizen.nfc.getDefaultAdapter();
- if (!gNfcAdapter.powered) {
- gNfcAdapter.setPowered(
- true, // Enable NFC adapter
- onPowerOn, // Handle success
- function () {console.log("Power on failed")}); // Handle failure
- } else {
- onPowerOn();
- }
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gNfcAdapter;
+var onPowerOn = function()
+{
+ /* Called when NFC adapter is powered on */
+ try
+ {
+ console.log("Power on succeed");
+ /* Implement NFC communication routines */
+ gNfcAdapter.setPowered(false, /* Disable NFC adapter */
+ function() {console.log("Power off succeed");}, /* Handle success */
+ function() {console.log("Power off failed");}); /* Handle failure */
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+try
+{
+ gNfcAdapter = tizen.nfc.getDefaultAdapter();
+ if (!gNfcAdapter.powered)
+ {
+ gNfcAdapter.setPowered(true, /* Enable NFC adapter */
+ onPowerOn, /* Handle success */
+ function() {console.log("Power on failed")}); /* Handle failure */
+ }
+ else
+ {
+ onPowerOn();
+ }
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::setTagListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
- var onSuccessCB = {onattach : function(nfcTag) {
- console.log("NFC Tag's type is " + nfcTag.type);
- }, ondetach : function() {
- console.log("NFC Tag is detached");
- }};
- adapter.setTagListener(onSuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+var onSuccessCB =
+{
+ onattach: function(nfcTag)
+ {
+ console.log("NFC Tag's type is " + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ console.log("NFC Tag is detached");
+ }
+};
+adapter.setTagListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::setPeerListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
- var onSuccessCB = {onattach : function(nfcPeer) {
- console.log("NFC Target is detected");
- }, ondetach : function() {
- console.log("NFC Target is detached");
- }};
- adapter.setPeerListener(onSuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+var onSuccessCB =
+{
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
+};
+adapter.setPeerListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::unsetTagListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
-
- // Receives NFCTag
- var onSuccessCB = {
- onattach : function(nfcTag) {
- console.log("The attached NFC tag's type is " + nfcTag.type);
- },
- ondetach : function() {
- console.log("NFC tag is detached.");
-
- // Unregister the listener when the NFC tag is detached.
- adapter.unsetTagListener();
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+
+/* Receives NFCTag */
+var onSuccessCB =
+{
+ onattach: function(nfcTag)
+ {
+ console.log("The attached NFC tag's type is " + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ console.log("NFC tag is detached.");
+
+ /* Unregister the listener when the NFC tag is detached */
+ adapter.unsetTagListener();
+ }
+};
- // Registers to be notified when NFC tag is detected.
- adapter.setTagListener(onSuccessCB);
- </pre>
+/* Registers to be notified when NFC tag is detected */
+adapter.setTagListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::unsetPeerListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
-
- // Receives an NFC peer.
- var onSuccessCB = {
- onattach : function(nfcPeer) {
- console.log("NFC peer target is attached.");
- },
- ondetach : function() {
- console.log("NFC peer target is detached.");
-
- // Unregisters the listener when NFC peer target is detached.
- adapter.unsetPeerListener();
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+
+/* Receives an NFC peer */
+var onSuccessCB =
+{
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC peer target is attached.");
+ },
+ ondetach: function()
+ {
+ console.log("NFC peer target is detached.");
+
+ /* Unregisters the listener when NFC peer target is detached */
+ adapter.unsetPeerListener();
+ }
+};
- // Registers to be notified when NFC peer target is detected.
- adapter.setPeerListener(onSuccessCB);
- </pre>
+/* Registers to be notified when NFC peer target is detected */
+adapter.setPeerListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::addCardEmulationModeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var onSuccessCB = function(mode) {
- console.log("The card emulation mode is " + mode);
- };
- var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onSuccessCB = function(mode)
+ {
+ console.log("The card emulation mode is " + mode);
+ };
+ var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::removeCardEmulationModeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.removeCardEmulationModeChangeListener(listenerId) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.removeCardEmulationModeChangeListener(listenerId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::addTransactionEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data){console.log("transaction event occurs");}) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data) {console.log("transaction event occurs");});
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::removeTransactionEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.removeTransactionEventListener(listenerId) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.removeTransactionEventListener(listenerId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::addActiveSecureElementChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var onSuccessCB = function(seType) {
- console.log("Active secure element is " + seType);
- };
- var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onSuccessCB = function(seType)
+ {
+ console.log("Active secure element is " + seType);
+ };
+ var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::removeActiveSecureElementChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.removeActiveSecureElementChangeListener(listenerId) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.removeActiveSecureElementChangeListener(listenerId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::getCachedMessage">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the cached message
- var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the cached message */
+var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::setExclusiveModeForTransaction">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.setExclusiveModeForTransaction(true) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.setExclusiveModeForTransaction(true);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::addHCEEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var onDetectedCB = function(event_data) {
- console.log("HCE event type is " + event_data.eventType);
- console.log("APDU is " + event_data.apdu);
- };
- var listenerId = adapter.addHCEEventListener(onDetectedCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var onDetectedCB = function(event_data)
+ {
+ console.log("HCE event type is " + event_data.eventType);
+ console.log("APDU is " + event_data.apdu);
+ };
+ var listenerId = adapter.addHCEEventListener(onDetectedCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::removeHCEEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- adapter.removeHCEEventListener(listenerId) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ adapter.removeHCEEventListener(listenerId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::sendHostAPDUResponse">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var successCB = function() {
- console.log("Sending APDU reponse was successful.");
- };
-
- var errorCB = function() {
- console.log("Sending APDU reponse failed.");
- };
-
- var apdu_response= [0x00,0xA4,0x04,0x00,0x04,0x11,0x12, 0x13, 0x14]; //set apdu response.
- adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB) ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var successCB = function()
+ {
+ console.log("Sending APDU response was successful.");
+ };
+
+ var errorCB = function()
+ {
+ console.log("Sending APDU response failed.");
+ };
+
+ var apdu_response= [0x00,0xA4,0x04,0x00,0x04,0x11,0x12, 0x13, 0x14]; /* Set apdu response */
+ adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::isActivatedHandlerForAID">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var aid = "ABC0012345";
- var isActiveHandler = adapter.isActivatedHandlerForAID("HCE", aid);
- if(isActiveHandler){
- console.log("current application is activated handler for the AID");
- }
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var aid = "ABC0012345";
+ var isActiveHandler = adapter.isActivatedHandlerForAID("HCE", aid);
+ if (isActiveHandler)
+ {
+ console.log("current application is activated handler for the AID");
+ }
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::isActivatedHandlerForCategory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var isActiveHandler = adapter.isActivatedHandlerForCategory("ESE", "PAYMENT") ;
- if(isActiveHandler){
- console.log("current application is activated handler for the category");
- }
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var isActiveHandler = adapter.isActivatedHandlerForCategory("ESE", "PAYMENT");
+ if (isActiveHandler)
+ {
+ console.log("current application is activated handler for the category");
+ }
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::registerAID">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var aid = "ABC0012345";
- adapter.registerAID("HCE", aid, "PAYMENT") ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var aid = "ABC0012345";
+ adapter.registerAID("HCE", aid, "PAYMENT");
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::unregisterAID">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- var aid = "ABC0012345";
- adapter.unregisterAID("HCE", aid, "PAYMENT") ;
- } catch (err) {
- console.log(err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var aid = "ABC0012345";
+ adapter.unregisterAID("HCE", aid, "PAYMENT");
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NFCAdapter::getAIDsForCategory">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
- var onSuccessCB = {onattach : function(nfcTag) {
- console.log("NFC Tag's type is " + nfcTag.type);
- for(var i in nfcTag.properties) {
- console.log("key:" + i + " value:" + nfcTag.properties[i]);
- }
- }, ondetach : function() {
- console.log("NFC Tag is detached");
- }};
- adapter.setTagListener(onSuccessCB);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+var onSuccessCB =
+{
+ onattach: function(nfcTag)
+ {
+ console.log("NFC Tag's type is " + nfcTag.type);
+ for (var i in nfcTag.properties)
+ {
+ console.log("key:" + i + " value:" + nfcTag.properties[i]);
+ }
+ },
+ ondetach: function()
+ {
+ console.log("NFC Tag is detached");
+ }
+};
+adapter.setTagListener(onSuccessCB);
+</pre>
</div>
</li>
<li class="attribute" id="NFCTag::isConnected">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
-
- // Receives NFCPeer
- var onSuccessCB = {onattach : function(nfcPeer) {
- console.log("NFC Target is detected");
- nfcPeer.setReceiveNDEFListener(
- function(message){
- console.log("Receive message");
- });
- }, ondetach : function() {
- console.log("NFC Target is detached");
- }};
-
- adapter.setPeerListener(onSuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+
+/* Receives NFCPeer */
+var onSuccessCB =
+{
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ nfcPeer.setReceiveNDEFListener(function(message)
+ {
+ console.log("Receive message");
+ });
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
+};
+
+adapter.setPeerListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCPeer::unsetReceiveNDEFListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var adapter = tizen.nfc.getDefaultAdapter();
- var onSuccessCB = {onattach : function(nfcPeer) {
- console.log("NFC Target is detected");
- nfcPeer.setReceiveNDEFListener(
- function(message){
- console.log("Receive message");
- nfcPeer.unsetReceiveNDEFListener();
- });
- }, ondetach : function() {
- console.log("NFC Target is detached");
- }};
- }
-
- adapter.setPeerListener(onSuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var adapter = tizen.nfc.getDefaultAdapter();
+var onSuccessCB =
+{
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ nfcPeer.setReceiveNDEFListener(function(message)
+ {
+ console.log("Receive message");
+ nfcPeer.unsetReceiveNDEFListener();
+ });
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
+};
+
+adapter.setPeerListener(onSuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="NFCPeer::sendNDEF">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the cached message.
- var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
- var raw = cachedMessage.toByte();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the cached message */
+var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
+var raw = cachedMessage.toByte();
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Creates a new NDEF record.
- var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
- var payload = newRecord.payload;
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Creates a new NDEF record */
+var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
+var payload = newRecord.payload;
+</pre>
</div>
</li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/create_content",
- null,
- "image/jpg",
- null);
- var notificationDict = {
- content : "This is a simple notification.",
- iconPath : "images/image1.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true,
- appControl : appControl};
-
- var notification = new tizen.StatusNotification("SIMPLE",
- "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
+ null, "image/jpg", null);
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appControl: appControl
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::update">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Uses a variable for the previously posted notification.
- notification.content = "My notification";
- tizen.notification.update(notification);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Uses a variable for the previously posted notification */
+ notification.content = "My notification";
+ tizen.notification.update(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::remove">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Uses a variable for the previously posted notification.
- tizen.notification.remove(notification.id);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Uses a variable for the previously posted notification */
+ tizen.notification.remove(notification.id);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::removeAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.notification.removeAll();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.notification.removeAll();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::get">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Uses a variable for the previously posted notification
- // Saves the notification ID for future use
- var myId = notification.id;
-
- var myNotification = tizen.notification.get(myId);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Uses a variable for the previously posted notification */
+ /* Saves the notification ID for future use */
+ var myId = notification.id;
+
+ var myNotification = tizen.notification.get(myId);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="NotificationManager::getAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var notifications = tizen.notification.getAll();
- var index = 0;
-
- for ( index = 0; index < notifications.length; index++ )
- {
- console.log(notifications[index].id);
- console.log(notifications[index].title);
- console.log(notifications[index].statusType);
- console.log(notifications[index].type);
- console.log(notifications[index].content);
- console.log(notifications[index].postedTime);
- console.log(notifications[index].iconPath);
- console.log(notifications[index].soundPath);
- console.log(notifications[index].vibration);
- console.log(notifications[index].appControl);
- }
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var notifications = tizen.notification.getAll();
+ var index = 0;
+
+ for (index = 0; index < notifications.length; index++)
+ {
+ console.log(notifications[index].id);
+ console.log(notifications[index].title);
+ console.log(notifications[index].statusType);
+ console.log(notifications[index].type);
+ console.log(notifications[index].content);
+ console.log(notifications[index].postedTime);
+ console.log(notifications[index].iconPath);
+ console.log(notifications[index].soundPath);
+ console.log(notifications[index].vibration);
+ console.log(notifications[index].appControl);
+ }
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var notificationDict = {
- content : "This is a simple notification.",
- iconPath : "images/image1.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true,
- ledColor : "#FFFF00",
- ledOnPeriod: 1000,
- ledOffPeriod : 500 };
-
- var notification = new tizen.StatusNotification("SIMPLE",
- "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ ledColor: "#FFFF00",
+ ledOnPeriod: 1000,
+ ledOffPeriod: 500
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</li>
<li class="attribute" id="StatusNotification::ledOnPeriod">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
-
- // Gets the current application information with tizen.application.getAppInfo
- var myappInfo = tizen.application.getAppInfo();
-
- var notificationDict = {
- content : "This is a simple notification.",
- iconPath : "images/image1.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true,
- appId : myappInfo.id };
-
- var notification = new tizen.StatusNotification("SIMPLE",
- "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Gets the current application information with tizen.application.getAppInfo */
+ var myappInfo = tizen.application.getAppInfo();
+
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appId: myappInfo.id
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</li>
<li class="attribute" id="StatusNotification::progressType">
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var appControl = new tizen.ApplicationControl(
- "http://tizen.org/appcontrol/operation/create_content",
- null,
- "image/jpg",
- null);
-
- var notificationDict = {
- content : "This is a progress notification.",
- iconPath : "images/image2.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true,
- appControl : appControl,
- progressValue : 20};
- // Constructs the progress notification
- var notification = new tizen.StatusNotification("PROGRESS",
- "Progress notification", notificationDict);
- // Posts the notification
- tizen.notification.post(notification);
-
- // Updates the progress value of the notification
- notification.progressValue = 59;
- tizen.notification.update(notification);
-
-
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
+ null, "image/jpg", null);
+
+ var notificationDict =
+ {
+ content: "This is a progress notification.",
+ iconPath: "images/image2.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appControl: appControl,
+ progressValue: 20
+ };
+ /* Constructs the progress notification */
+ var notification = new tizen.StatusNotification("PROGRESS", "Progress notification", notificationDict);
+ /* Posts the notification */
+ tizen.notification.post(notification);
+
+ /* Updates the progress value of the notification */
+ notification.progressValue = 59;
+ tizen.notification.update(notification);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</li>
</ul>
2.3.1
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013');
- notification.detailInfo = [detailInfo1];
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013');
+notification.detailInfo = [detailInfo1];
</pre>
</div>
<div class="constructors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var onInstallation = {
- onprogress: function(packageId, percentage) {
- console.log("On installation(" + packageId + ") : progress(" + percentage + ")");
- },
- oncomplete: function(packageId) {
- console.log("Installation(" + packageId + ") Complete");
- }
- }
-
- var onError = function (err) {
- console.log("Error occurred on installation : " + err.name);
- }
-
- // Let's assume that the "test.wgt" file exists in the downloads directory
- tizen.filesystem.resolve("downloads/test.wgt",
- function (file) {
- console.log("file URI : " + file.toURI());
- tizen.package.install(file.toURI(), onInstallation, onError);
- },
- function (err) {
- console.log("Error occurred on resolve : " + err.name);
- },
- "r");
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var onInstallation =
+{
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On installation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Installation(" + packageId + ") Complete");
+ }
+}
+
+var onError = function(err)
+{
+ console.log("Error occurred on installation: " + err.name);
+}
+
+/* Let's assume that the "test.wgt" file exists in the downloads directory */
+tizen.filesystem.resolve("downloads/test.wgt", function(file)
+{
+ console.log("file URI: " + file.toURI());
+ tizen.package.install(file.toURI(), onInstallation, onError);
+}, function(err)
+{
+ console.log("Error occurred on resolve: " + err.name);
+}, "r");
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::uninstall">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var onUninstallation = {
- onprogress: function(packageId, percentage) {
- console.log("On Uninstallation(" + packageId + ") : progress(" + percentage + ")");
- },
- oncomplete: function(packageId) {
- console.log("Uninstallation(" + packageId + ") Complete");
- }
- };
-
- var onError = function (err) {
- console.log("Error occurred on installation : " + err.name);
- };
-
- // Let's assume that the package ID to uninstall is "testapp001"
- tizen.package.uninstall("testapp001", onUninstallation, onError);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var onUninstallation =
+{
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Uninstallation(" + packageId + ") Complete");
+ }
+};
+
+var onError = function(err)
+{
+ console.log("Error occurred on installation: " + err.name);
+};
+
+/* Let's assume that the package ID to uninstall is "testapp001" */
+tizen.package.uninstall("testapp001", onUninstallation, onError);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::getPackagesInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onListInstalledPackages(packages) {
- for (var i = 0; i < packages.length; i++) {
- console.log("Package id["+i+"] : " +packages[i].id);
- }
- }
-
- tizen.package.getPackagesInfo(
- onListInstalledPackages,
- function (err) {console.log("Can't obtain packages list" + err.name);});
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onListInstalledPackages(packages)
+{
+ for (var i = 0; i < packages.length; i++)
+ {
+ console.log("Package id[" + i + "]: " + packages[i].id);
+ }
+}
+
+tizen.package.getPackagesInfo(onListInstalledPackages, function(err)
+{
+ console.log("Can't obtain packages list" + err.name);
+});
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::getPackageInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var packageInfo = tizen.package.getPackageInfo(null);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var packageInfo = tizen.package.getPackageInfo(null);
- console.log("Current Package ID : " + packageInfo.id);
- </pre>
+console.log("Current Package ID: " + packageInfo.id);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::setPackageInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var packageEventCallback = {
- oninstalled: function(packageInfo) {
- console.log('The package ' + packageInfo.name + ' is installed');
- },
- onupdated: function(packageInfo) {
- console.log('The package ' + packageInfo.name + ' is updated');
- },
- onuninstalled: function(packageId) {
- console.log('The package ' + packageId + ' is uninstalled');
- }
- };
-
- tizen.package.setPackageInfoEventListener(packageEventCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var packageEventCallback =
+{
+ oninstalled: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is installed');
+ },
+ onupdated: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is updated');
+ },
+ onuninstalled: function(packageId)
+ {
+ console.log('The package ' + packageId + ' is uninstalled');
+ }
+};
+
+tizen.package.setPackageInfoEventListener(packageEventCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PackageManager::unsetPackageInfoEventListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.package.unsetPackageInfoEventListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.package.unsetPackageInfoEventListener();
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.power.request("SCREEN", "SCREEN_NORMAL");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.power.request("SCREEN", "SCREEN_NORMAL");
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::release">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Release SCREEN resource.
- tizen.power.release("SCREEN");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Release SCREEN resource */
+tizen.power.release("SCREEN");
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::setScreenStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onScreenStateChanged(previousState, changedState) {
- console.log("Screen state changed from " + previousState + " to " + changedState);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onScreenStateChanged(previousState, changedState)
+{
+ console.log("Screen state changed from " + previousState + " to " + changedState);
+}
- // Sets the screen state change listener.
- tizen.power.setScreenStateChangeListener(onScreenStateChanged);
- </pre>
+/* Sets the screen state change listener */
+tizen.power.setScreenStateChangeListener(onScreenStateChanged);
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::unsetScreenStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Unsets the screen state change listener.
- tizen.power.unsetScreenStateChangeListener();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Unsets the screen state change listener */
+tizen.power.unsetScreenStateChangeListener();
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::getScreenBrightness">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Gets the current screen brightness value.
- var screenBrightness = tizen.power.getScreenBrightness();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Gets the current screen brightness value */
+var screenBrightness = tizen.power.getScreenBrightness();
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::setScreenBrightness">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Sets the screen brightness value for the application.
- tizen.power.setScreenBrightness(1);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Sets the screen brightness value for the application */
+tizen.power.setScreenBrightness(1);
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::isScreenOn">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Checks whether the screen is on or off.
- var isScreenOn = tizen.power.isScreenOn();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Checks whether the screen is on or off */
+var isScreenOn = tizen.power.isScreenOn();
+</pre>
</div>
</dd>
<dt class="method" id="PowerManager::restoreScreenBrightness">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Restores the screen brightness value to the system default setting value.
- tizen.power.restoreScreenBrightness();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Restores the screen brightness value to the system default setting value */
+tizen.power.restoreScreenBrightness();
+</pre>
</div>
</dd>
<dt class="deprecated method" id="PowerManager::turnScreenOn">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Turns the screen on.
- tizen.power.turnScreenOn();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Turns the screen on */
+tizen.power.turnScreenOn();
+</pre>
</div>
</dd>
<dt class="deprecated method" id="PowerManager::turnScreenOff">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Turns the screen off.
- tizen.power.turnScreenOff();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Turns the screen off */
+tizen.power.turnScreenOff();
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var successCB = function(preferences) {
- if (preferences.length) {
- console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var successCB = function(preferences)
+{
+ if (preferences.length)
+ {
+ console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
+ }
+};
- tizen.preference.getAll(successCB);
- </pre>
+tizen.preference.getAll(successCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> The first preference - key: key1 value: Sample value
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.preference.setValue('key1', 'New value');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.preference.setValue('key1', 'New value');
+</pre>
</div>
</dd>
<dt class="method" id="PreferenceManager::getValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var currentValue = tizen.preference.getValue('key1');
- console.log('The current value of the preference key1 is: ' + currentValue);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var currentValue = tizen.preference.getValue('key1');
+console.log('The current value of the preference key1 is: ' + currentValue);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> The current value of the preference key1 is: New value
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.preference.remove('key1');
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.preference.remove('key1');
+</pre>
</div>
</dd>
<dt class="method" id="PreferenceManager::removeAll">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.preference.removeAll();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.preference.removeAll();
+</pre>
</div>
</dd>
<dt class="method" id="PreferenceManager::exists">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> if (tizen.preference.exists('key1')) {
- console.log('Preference with the key key1 exists');
- } else {
- console.log('Preference with the key key1 doesn't exist');
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+if (tizen.preference.exists('key1'))
+{
+ console.log('Preference with the key key1 exists');
+}
+else
+{
+ console.log('Preference with the key key1 doesn't exist');
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Preference with the key key1 exists
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = function(data) {
- console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener = function(data)
+{
+ console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
+};
- tizen.preference.setChangeListener('key1', listener);
- </pre>
+tizen.preference.setChangeListener('key1', listener);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Preference with the key: key1 has a new value: Sample value
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = function(data) {
- tizen.preference.unsetChangeListener(data.key);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener = function(data)
+{
+ tizen.preference.unsetChangeListener(data.key);
+};
- tizen.preference.setChangeListener('key1', listener);
- </pre>
+tizen.preference.setChangeListener('key1', listener);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = function(data) {
- tizen.preference.unsetChangeListener(data.key);
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener = function(data)
+{
+ tizen.preference.unsetChangeListener(data.key);
+};
- tizen.preference.setChangeListener('key1', listener);
- </pre>
+tizen.preference.setChangeListener('key1', listener);
+</pre>
</div>
</dd>
</dl>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var successCB = function(preferences) {
- if (preferences.length) {
- console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var successCB = function(preferences)
+{
+ if (preferences.length)
+ {
+ console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
+ }
+};
- tizen.preference.getAll(successCB);
- </pre>
+tizen.preference.getAll(successCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> First preference - key: key1 value: Sample value
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the data to be used when this process is launched by notification service.
- var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the data to be used when this process is launched by notification service */
+var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");
- // Defines the error callback.
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
- // Defines the registration success callback
- function registerSuccessCallback(id) {
- console.log("Registration succeeded with id: " + id);
- }
+/* Defines the registration success callback */
+function registerSuccessCallback(id)
+{
+ console.log("Registration succeeded with id: " + id);
+}
- // Requests registration.
- tizen.push.registerService(service, registerSuccessCallback, errorCallback);
- </pre>
+/* Requests registration */
+tizen.push.registerService(service, registerSuccessCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::register">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback.
- function errorCallback(response) {
- console.log("The following error occurred: " + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log("The following error occurred: " + response.name);
+}
- // Defines the registration success callback
- function registerSuccessCallback(id) {
- console.log("Registration succeeded with id: " + id);
- }
+/* Defines the registration success callback */
+function registerSuccessCallback(id)
+{
+ console.log("Registration succeeded with id: " + id);
+}
- // Requests application registration.
- tizen.push.register(registerSuccessCallback, errorCallback);
- </pre>
+/* Requests application registration */
+tizen.push.register(registerSuccessCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback
- function errorCallback(response) {
- console.log( 'The following error occurred: ' + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log('The following error occurred: ' + response.name);
+}
- // Defines the unregistration success callback
- function unregisterSuccessCallback() {
- console.log("Unregistration succeeded.");
- }
+/* Defines the unregistration success callback */
+function unregisterSuccessCallback()
+{
+ console.log("Unregistration succeeded.");
+}
- // Requests unregistration
- tizen.push.unregisterService(unregisterSuccessCallback, errorCallback);
- </pre>
+/* Requests unregistration */
+tizen.push.unregisterService(unregisterSuccessCallback, errorCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::unregister">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the error callback
- function errorCallback(response) {
- console.log("The following error occurred: " + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the error callback */
+function errorCallback(response)
+{
+ console.log("The following error occurred: " + response.name);
+}
- // Defines the unregistration success callback
- function unregisterSuccessCallback() {
- console.log("Unregistration succeeded.");
- }
+/* Defines the unregistration success callback */
+function unregisterSuccessCallback()
+{
+ console.log("Unregistration succeeded.");
+}
- // Requests unregistration
- tizen.push.unregister(unregisterSuccessCallback, errorCallback);
- </pre>
+/* Requests unregistration */
+tizen.push.unregister(unregisterSuccessCallback, errorCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Unregistration succeeded.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the registration error callback.
- function errorCallback(response) {
- console.log("The following error occurred: " + response.name);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the registration error callback */
+function errorCallback(response)
+{
+ console.log("The following error occurred: " + response.name);
+}
- // Defines the registration success callback
- function registerSuccessCallback(id) {
- console.log("Registration succeeded with id: " + id);
- }
+/* Defines the registration success callback */
+function registerSuccessCallback(id)
+{
+ console.log("Registration succeeded with id: " + id);
+}
- // Requests application registration.
- tizen.push.register(registerSuccessCallback, errorCallback);
+/* Requests application registration */
+tizen.push.register(registerSuccessCallback, errorCallback);
- // Defines the connect success callback
- function notificationCallback(noti) {
- console.log("Notification received with alert message: " + noti.alertMessage);
- }
+/* Defines the connect success callback */
+function notificationCallback(noti)
+{
+ console.log("Notification received with alert message: " + noti.alertMessage);
+}
- // Requests for push service connection
- tizen.push.connectService(notificationCallback);
- </pre>
+/* Requests for push service connection */
+tizen.push.connectService(notificationCallback);
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::disconnectService">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Requests disconnection
- tizen.push.disconnectService();
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests disconnection */
+tizen.push.disconnectService();
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::getRegistrationId">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var registrationId = tizen.push.getRegistrationId();
- if ( registrationId != null ) {
- console.log("The registration id: " + registrationId);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var registrationId = tizen.push.getRegistrationId();
+if (registrationId != null)
+{
+ console.log("The registration id: " + registrationId);
+}
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::getUnreadNotifications">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the connect success callback
- function notificationCallback(message) {
- console.log("New push message : " + message.alertMessage + ", date : " + message.date + ", data : " + message.appData);
- }
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the connect success callback */
+function notificationCallback(message)
+{
+ console.log("New push message: " + message.alertMessage + ", date: " + message.date + ", data: " + message.appData);
+}
- // Requests for push service connection
- tizen.push.connectService(notificationCallback);
- tizen.push.getUnreadNotifications();
- </pre>
+/* Requests for push service connection */
+tizen.push.connectService(notificationCallback);
+tizen.push.getUnreadNotifications();
+</pre>
</div>
</dd>
<dt class="method" id="PushManager::getPushMessage">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- var message = tizen.push.getPushMessage();
- console.log('Message received from: ' + message.sender);
- } catch (err) {
- console.log('Exception - code: ' + err.name + ' message: ' + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ var message = tizen.push.getPushMessage();
+ console.log('Message received from: ' + message.sender);
+}
+catch (err)
+{
+ console.log('Exception - code: ' + err.name + ' message: ' + err.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Message received from: xyz.AnotherApp
3.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the connect success callback
- function notificationCallback(noti) {
- console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
- console.log('Details:');
- console.log(' - data: ' + noti.appData);
- console.log(' - alert message: ' + noti.alertMessage);
- console.log(' - message: ' + noti.message);
- console.log(' - session: ' + noti.sessionInfo);
- console.log(' - request ID: ' + noti.requestId);
- console.log(' - type: ' + noti.type);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the connect success callback */
+function notificationCallback(noti)
+{
+ console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
+ console.log('Details:');
+ console.log(' - data: ' + noti.appData);
+ console.log(' - alert message: ' + noti.alertMessage);
+ console.log(' - message: ' + noti.message);
+ console.log(' - session: ' + noti.sessionInfo);
+ console.log(' - request ID: ' + noti.requestId);
+ console.log(' - type: ' + noti.type);
+}
- // Requests for push service connection
- tizen.push.connectService(notificationCallback);
- </pre>
+/* Requests for push service connection */
+tizen.push.connectService(notificationCallback);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Notification received on Thu Jan 01 2015 from: xyz.AnotherApp
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- function success(readers) {
- for (var i = 0; i < readers.length; i++) {
- if (readers[i].isPresent) {
- console.log ("Reader Name : " + readers[i].getName());
- }
- }
- }
- function error(err) {
- console.log (err.name + ": " + err.message);
- }
- tizen.seService.getReaders(success, error);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ function success(readers)
+ {
+ for (var i = 0; i < readers.length; i++)
+ {
+ if (readers[i].isPresent)
+ {
+ console.log("Reader Name: " + readers[i].getName());
+ }
+ }
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ tizen.seService.getReaders(success, error);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SEService::registerSEListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var listener = {
- onSEReady: function(reader) {
- console.log(reader.getName() + " is ready.");
- },
- onSENotReady: function(reader) {
- console.log(reader.getName() + " is not ready.");
- },
- onSEError: function(reader, error) {
- console.log(reader.getName() + ": error occurred: " + error.message);
- }
- };
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var listener =
+{
+ onSEReady: function(reader)
+ {
+ console.log(reader.getName() + " is ready.");
+ },
+ onSENotReady: function(reader)
+ {
+ console.log(reader.getName() + " is not ready.");
+ },
+ onSEError: function(reader, error)
+ {
+ console.log(reader.getName() + ": error occurred: " + error.message);
+ }
+};
- try {
- var seListener = tizen.seService.registerSEListener(listener);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+try
+{
+ var seListener = tizen.seService.registerSEListener(listener);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SEService::unregisterSEListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var seListener; //seListener obtained from registerSEListener
- try {
- tizen.seService.unregisterSEListener(seListener);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var seListener; /* seListener obtained from registerSEListener */
+try
+{
+ tizen.seService.unregisterSEListener(seListener);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SEService::shutdown">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- tizen.seService.shutdown();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ tizen.seService.shutdown();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- function success(readers) {
- for (var i = 0; i < readers.length; i++) {
- if (readers[i].isPresent) {
- console.log ("Reader Name : " + readers[i].getName());
- }
- }
- }
- function error(err) {
- console.log (err.name + ": " + err.message);
- }
- tizen.seService.getReaders(success, error);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ function success(readers)
+ {
+ for (var i = 0; i < readers.length; i++)
+ {
+ if (readers[i].isPresent)
+ {
+ console.log("Reader Name: " + readers[i].getName());
+ }
+ }
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ tizen.seService.getReaders(success, error);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Reader::openSession">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- function success(session) {
- console.log ("Open Session Success : " + !session.isClosed);
- }
- function error(err) {
- console.log (err.name + ": " + err.message);
- }
- reader.openSession(success, error);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ function success(session)
+ {
+ console.log("Open Session Success: " + !session.isClosed);
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ reader.openSession(success, error);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Reader::closeSessions">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- reader.closeSessions();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ reader.closeSessions();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- function successChannel(channel) {
- if (channel.isBasicChannel) {
- console.log ("Basic channel is opened.");
- } else {
- console.log ("Logical channel is opened.");
- }
- }
- function errorChannel(err) {
- console.log ("openBasicChannel Error :" + err.name +": " + err.message);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ function successChannel(channel)
+ {
+ if (channel.isBasicChannel)
+ {
+ console.log("Basic channel is opened.");
+ }
+ else
+ {
+ console.log("Logical channel is opened.");
+ }
+ }
+ function errorChannel(err)
+ {
+ console.log("openBasicChannel Error:" + err.name +": " + err.message);
+ }
- function successSession(session) {
- console.log ("Open Session Success : " + !session.isClosed);
- // This aid is for test. Use aid for your applet in secure element.
- session.openBasicChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
- }
- function errorSession(err) {
- console.log ("openSession Error : " + err.name + ": " + err.message);
- }
- reader.openSession(successSession, errorSession);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+ function successSession(session)
+ {
+ console.log("Open Session Success: " + !session.isClosed);
+ /* This aid is for test. Use aid for your applet in secure element */
+ session.openBasicChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
+ }
+ function errorSession(err)
+ {
+ console.log("openSession Error: " + err.name + ": " + err.message);
+ }
+ reader.openSession(successSession, errorSession);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Session::openLogicalChannel">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var session; //Session obtained from openSession callback
- try {
- function successChannel(channel) {
- if (channel.isBasicChannel) {
- console.log ("Basic channel is opened.");
- } else {
- console.log ("Logical channel is opened.");
- }
- }
- function errorChannel(err) {
- console.log ("openLogicalChannel Error :" + err.name + ": " + err.message);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var session; /* Session obtained from openSession callback */
+try
+{
+ function successChannel(channel)
+ {
+ if (channel.isBasicChannel)
+ {
+ console.log("Basic channel is opened.");
+ }
+ else
+ {
+ console.log("Logical channel is opened.");
+ }
+ }
+ function errorChannel(err)
+ {
+ console.log("openLogicalChannel Error:" + err.name + ": " + err.message);
+ }
- // This aid is for test. Use aid for your applet in secure element.
- session.openLogicalChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+ /* This aid is for test. Use aid for your applet in secure element */
+ session.openLogicalChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Session::getATR">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var session; //Session obtained from openSession callback
- try {
- var atr = session.getATR();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var session; /* Session obtained from openSession callback */
+try
+{
+ var atr = session.getATR();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Session::close">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var session; //Session obtained from openSession callback
- try {
- session.close();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var session; /* Session obtained from openSession callback */
+try
+{
+ session.close();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Session::closeChannels">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var session; //Session obtained from openSession callback
- try {
- session.closeChannels();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var session; /* Session obtained from openSession callback */
+try
+{
+ session.closeChannels();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var channel; //Obtained from openLogicalChannel or openBasicChannel
- try {
- channel.close();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var channel; /* Obtained from openLogicalChannel or openBasicChannel */
+try
+{
+ channel.close();
+}
+catch (err)
+{
+ console.log(err.name + ": " + err.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="Channel::transmit">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximityCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.proximity");
-
- if (proximityCapability === true) {
- // the device supports proximity sensor and you can get proximity sensor's data
- var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- } else {
- // If tizen.sensorservice.getDefaultSensor("PROXIMITY") is used, NotSupportedError would be thrown.
- console.log("Proximity sensor is not supported on this device.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximityCapability = tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.proximity");
+
+if (proximityCapability === true)
+{
+ /* Device supports proximity sensor and you can get proximity sensor's data */
+ var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+}
+else
+{
+ /* If tizen.sensorservice.getDefaultSensor("PROXIMITY") is used, NotSupportedError is thrown */
+ console.log("Proximity sensor is not supported on this device.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SensorService::getAvailableSensors">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var sensorCapabilities = tizen.sensorservice.getAvailableSensors();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var sensorCapabilities = tizen.sensorservice.getAvailableSensors();
- console.log("capable sensor : " + sensorCapabilities[0]);
- </pre>
+console.log("capable sensor: " + sensorCapabilities[0]);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- function onsuccessCB() {
- console.log("The proximity sensor started successfully.");
- }
+function onsuccessCB()
+{
+ console.log("The proximity sensor started successfully.");
+}
- proximitySensor.start(onsuccessCB);
- </pre>
+proximitySensor.start(onsuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="Sensor::stop">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- function onsuccessCB() {
- console.log("proximity sensor start");
- proximitySensor.stop();
- }
+function onsuccessCB()
+{
+ console.log("proximity sensor start");
+ proximitySensor.stop();
+}
- proximitySensor.start(onsuccessCB);
- </pre>
+proximitySensor.start(onsuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="Sensor::setChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
- function onsuccessCB() {
+function onsuccessCB()
+{
console.log("light sensor start");
- }
+}
- function onchangedCB(sensorData) {
+function onchangedCB(sensorData)
+{
console.log("light level: " + sensorData.lightLevel);
- }
+}
- // interval and batchLatency can be ommitted.
- lightSensor.setChangeListener(onchangedCB, 200, 2000);
+/* interval and batchLatency can be omitted */
+lightSensor.setChangeListener(onchangedCB, 200, 2000);
- lightSensor.start(onsuccessCB);
- </pre>
+lightSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
<dt class="method" id="Sensor::unsetChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- function onchangedCB(sensorData) {
- console.log("proximity distance : " + sensorData.proximityState);
- }
+function onchangedCB(sensorData)
+{
+ console.log("proximity distance: " + sensorData.proximityState);
+}
- proximitySensor.setChangeListener(onchangedCB);
+proximitySensor.setChangeListener(onchangedCB);
- proximitySensor.unsetChangeListener();
- </pre>
+proximitySensor.unsetChangeListener();
+</pre>
</div>
</dd>
<dt class="method" id="Sensor::getSensorHardwareInfo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gravitySensor = tizen.sensorservice.getDefaultSensor("GRAVITY");
- gravitySensor.getSensorHardwareInfo(onsuccessCB);
-
- function onsuccessCB(hardwareInfo){
- console.log("name: " + hardwareInfo.name);
- console.log("type: " + hardwareInfo.type);
- console.log("vendor: " + hardwareInfo.vendor);
- console.log("minValue: " + hardwareInfo.minValue);
- console.log("maxValue: " + hardwareInfo.maxValue);
- console.log("resolution: " + hardwareInfo.resolution);
- console.log("minInterval: " + hardwareInfo.minInterval);
- console.log("maxBatchCount: " + hardwareInfo.maxBatchCount);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gravitySensor = tizen.sensorservice.getDefaultSensor("GRAVITY");
+gravitySensor.getSensorHardwareInfo(onsuccessCB);
+
+function onsuccessCB(hardwareInfo)
+{
+ console.log("name: " + hardwareInfo.name);
+ console.log("type: " + hardwareInfo.type);
+ console.log("vendor: " + hardwareInfo.vendor);
+ console.log("minValue: " + hardwareInfo.minValue);
+ console.log("maxValue: " + hardwareInfo.maxValue);
+ console.log("resolution: " + hardwareInfo.resolution);
+ console.log("minInterval: " + hardwareInfo.minInterval);
+ console.log("maxBatchCount: " + hardwareInfo.maxBatchCount);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> name: Gravity Sensor
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
-
- function onGetSuccessCB(sensorData) {
- console.log("light level : " + sensorData.lightLevel);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
- function onerrorCB(error) {
- console.log("error occured");
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("light level: " + sensorData.lightLevel);
+}
- function onsuccessCB() {
- console.log("sensor start");
- lightSensor.getLightSensorData(onGetSuccessCB, onerrorCB);
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- lightSensor.start(onsuccessCB);
+function onsuccessCB()
+{
+ console.log("sensor start");
+ lightSensor.getLightSensorData(onGetSuccessCB, onerrorCB);
+}
- </pre>
+lightSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var magneticSensor = tizen.sensorservice.getDefaultSensor("MAGNETIC");
-
- function onGetSuccessCB(sensorData) {
- console.log("magnetic field of the X axis : " + sensorData.x);
- console.log("magnetic field of the Y axis : " + sensorData.y);
- console.log("magnetic field of the Z axis : " + sensorData.z);
- }
-
- function onerrorCB(error) {
- console.log("error occured");
- }
-
- function onsuccessCB() {
- console.log("sensor start");
- magneticSensor.getMagneticSensorData(onGetSuccessCB, onerrorCB);
- }
-
- magneticSensor.start(onsuccessCB);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var magneticSensor = tizen.sensorservice.getDefaultSensor("MAGNETIC");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("magnetic field of the X axis: " + sensorData.x);
+ console.log("magnetic field of the Y axis: " + sensorData.y);
+ console.log("magnetic field of the Z axis: " + sensorData.z);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("sensor start");
+ magneticSensor.getMagneticSensorData(onGetSuccessCB, onerrorCB);
+}
+
+magneticSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var pressureSensor = tizen.sensorservice.getDefaultSensor("PRESSURE");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var pressureSensor = tizen.sensorservice.getDefaultSensor("PRESSURE");
- function onGetSuccessCB(sensorData) {
- console.log("pressure : " + sensorData.pressure);
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("pressure: " + sensorData.pressure);
+}
- function onerrorCB(error) {
- console.log("error occured");
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- function onsuccessCB() {
- console.log("sensor start");
- pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
- }
+function onsuccessCB()
+{
+ console.log("sensor start");
+ pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
+}
- pressureSensor.start(onsuccessCB);
-
- </pre>
+pressureSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
-
- function onGetSuccessCB(sensorData) {
- console.log("proximity state : " + sensorData.proximityState);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
- function onerrorCB(error) {
- console.log("error occured");
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("proximity state: " + sensorData.proximityState);
+}
- function onsuccessCB() {
- console.log("proximity sensor start");
- proximitySensor.getProximitySensorData(onGetSuccessCB, onerrorCB);
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- proximitySensor.start(onsuccessCB);
+function onsuccessCB()
+{
+ console.log("proximity sensor start");
+ proximitySensor.getProximitySensorData(onGetSuccessCB, onerrorCB);
+}
- </pre>
+proximitySensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var ultravioletSensor = tizen.sensorservice.getDefaultSensor("ULTRAVIOLET");
-
- function onGetSuccessCB(sensorData) {
- console.log("ultraviolet level : " + sensorData.ultravioletLevel);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var ultravioletSensor = tizen.sensorservice.getDefaultSensor("ULTRAVIOLET");
- function onerrorCB(error) {
- console.log("error occured");
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("ultraviolet level: " + sensorData.ultravioletLevel);
+}
- function onsuccessCB() {
- console.log("ultraviolet sensor start");
- ultravioletSensor.getUltravioletSensorData(onGetSuccessCB, onerrorCB);
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- ultravioletSensor.start(onsuccessCB);
+function onsuccessCB()
+{
+ console.log("ultraviolet sensor start");
+ ultravioletSensor.getUltravioletSensorData(onGetSuccessCB, onerrorCB);
+}
- </pre>
+ultravioletSensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var HRMrawsensor = tizen.sensorservice.getDefaultSensor("HRM_RAW");
-
- function onGetSuccessCB(sensorData) {
- console.log("HRMRaw light intensity : " + sensorData.lightIntensity);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var HRMrawsensor = tizen.sensorservice.getDefaultSensor("HRM_RAW");
- function onerrorCB(error) {
- console.log("error occured");
- }
+function onGetSuccessCB(sensorData)
+{
+ console.log("HRMRaw light intensity: " + sensorData.lightIntensity);
+}
- function onsuccessCB() {
- console.log("HRMRaw sensor start");
- HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
- }
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
- HRMrawsensor.start(onsuccessCB);
+function onsuccessCB()
+{
+ console.log("HRMRaw sensor start");
+ HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
+}
- </pre>
+HRMrawsensor.start(onsuccessCB);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gravitySensor = tizen.sensorservice.getDefaultSensor("GRAVITY");
-
- function onGetSuccessCB(sensorData) {
- console.log("######## Get the gravity sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- }
-
- function onerrorCB(error) {
- console.log("error occured");
- }
-
- function onsuccessCB() {
- console.log("sensor start");
- gravitySensor.getGravitySensorData(onGetSuccessCB, onerrorCB);
- }
-
- gravitySensor.start(onsuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gravitySensor = tizen.sensorservice.getDefaultSensor("GRAVITY");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("######## Get the gravity sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("sensor start");
+ gravitySensor.getGravitySensorData(onGetSuccessCB, onerrorCB);
+}
+
+gravitySensor.start(onsuccessCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> sensor start
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gyroscopeSensor = tizen.sensorservice.getDefaultSensor("GYROSCOPE");
-
- function onGetSuccessCB(sensorData) {
- console.log("######## Get the gyroscope sensor date ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- }
-
- function onerrorCB(error) {
- console.log("error occured");
- }
-
- function onsuccessCB() {
- console.log("sensor start");
- gyroscopeSensor.getGyroscopeSensorData(onGetSuccessCB, onerrorCB);
- }
-
- gyroscopeSensor.start(onsuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gyroscopeSensor = tizen.sensorservice.getDefaultSensor("GYROSCOPE");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("######## Get the gyroscope sensor date ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("sensor start");
+ gyroscopeSensor.getGyroscopeSensorData(onGetSuccessCB, onerrorCB);
+}
+
+gyroscopeSensor.start(onsuccessCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> sensor start
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var gyroscopeRotationVectorSensor = tizen.sensorservice.getDefaultSensor("GYROSCOPE_ROTATION_VECTOR");
-
- function onGetSuccessCB(sensorData) {
- console.log("######## Get the gyroscope rotation vector sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- console.log("w: " + sensorData.w);
- }
-
- function onerrorCB(error) {
- console.log("error occured");
- }
-
- function onsuccessCB() {
- console.log("sensor start");
- gyroscopeRotationVectorSensor.getGyroscopeRotationVectorSensorData(onGetSuccessCB, onerrorCB);
- }
-
- gyroscopeRotationVectorSensor.start(onsuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var gyroscopeRotationVectorSensor = tizen.sensorservice.getDefaultSensor("GYROSCOPE_ROTATION_VECTOR");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("######## Get the gyroscope rotation vector sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+ console.log("w: " + sensorData.w);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("sensor start");
+ gyroscopeRotationVectorSensor.getGyroscopeRotationVectorSensorData(onGetSuccessCB, onerrorCB);
+}
+
+gyroscopeRotationVectorSensor.start(onsuccessCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> sensor start
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var linearAccelerationSensor = tizen.sensorservice.getDefaultSensor("LINEAR_ACCELERATION");
-
- function onGetSuccessCB(sensorData) {
- console.log("######## Get the linear acceleration sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- }
-
- function onerrorCB(error) {
- console.log("error occured");
- }
-
- function onsuccessCB() {
- console.log("linear acceleration sensor start");
- linearAccelerationSensor.getLinearAccelerationSensorData(onGetSuccessCB, onerrorCB);
- }
-
- linearAccelerationSensor.start(onsuccessCB);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var linearAccelerationSensor = tizen.sensorservice.getDefaultSensor("LINEAR_ACCELERATION");
+
+function onGetSuccessCB(sensorData)
+{
+ console.log("######## Get the linear acceleration sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+}
+
+function onerrorCB(error)
+{
+ console.log("error occurred");
+}
+
+function onsuccessCB()
+{
+ console.log("linear acceleration sensor start");
+ linearAccelerationSensor.getLinearAccelerationSensorData(onGetSuccessCB, onerrorCB);
+}
+
+linearAccelerationSensor.start(onsuccessCB);
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> linear acceleration sensor start
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var infoArr = tizen.sound.getConnectedDeviceList();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var infoArr = tizen.sound.getConnectedDeviceList();
- for (var i = 0; i < infoArr.length; i++) {
- cosole.log( infoArr[i].device );
- }
- </pre>
+for (var i = 0; i < infoArr.length; i++)
+{
+ console.log(infoArr[i].device);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SoundManager::getActivatedDeviceList">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var infoArr = tizen.sound.getActivatedDeviceList();
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var infoArr = tizen.sound.getActivatedDeviceList();
- for (var i = 0; i < infoArr.length; i++) {
- cosole.log( infoArr[i].device );
- }
- </pre>
+for (var i = 0; i < infoArr.length; i++)
+{
+ console.log(infoArr[i].device);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SoundManager::addDeviceStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // A callback
- var onChanged = function(info) {
- // Some code to execute when a sound device state is changed
- if (info.isConnected) {
- // Some code to execute if the device is connected.
- console.log( info.device + " is connected" );
- } else {
- // Some code to execute if the device is not connected.
- console.log( info.device + " is not connected" );
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Callback */
+var onChanged = function(info)
+{
+ /* Some code to execute when a sound device state is changed */
+ if (info.isConnected)
+ {
+ /* Some code to execute if the device is connected */
+ console.log(info.device + " is connected");
+ }
+ else
+ {
+ /* Some code to execute if the device is not connected */
+ console.log(info.device + " is not connected");
+ }
- if (info.isActivated) {
- // Some code to execute if the device is activated.
- console.log( info.device + " is activated" );
- } else {
- // Some code to execute if the device is not activated.
- console.log( info.device + " is not activated" );
- }
- }
+ if (info.isActivated)
+ {
+ /* Some code to execute if the device is activated */
+ console.log(info.device + " is activated");
+ }
+ else
+ {
+ /* Some code to execute if the device is not activated */
+ console.log(info.device + " is not activated");
+ }
+}
- var id = tizen.sound.addDeviceStateChangeListener(onChanged);
- </pre>
+var id = tizen.sound.addDeviceStateChangeListener(onChanged);
+</pre>
</div>
</dd>
<dt class="method" id="SoundManager::removeDeviceStateChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // If a listener to be called was registered previously.
- tizen.sound.removeDeviceStateChangeListener(id);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* If a listener to be called was registered previously */
+tizen.sound.removeDeviceStateChangeListener(id);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // To get total amount of system memory
- console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* To get total amount of system memory */
+console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getAvailableMemory">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // To get total amount of system memory
- console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* To get total amount of system memory */
+console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
+</pre>
</div>
</dd>
<dt class="deprecated method" id="SystemInfo::getCapabilities">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var deviceCapabilities;
- deviceCapabilities = tizen.systeminfo.getCapabilities();
- if (deviceCapabilities.bluetooth) {
- console.log("Bluetooth is supported");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var deviceCapabilities;
+deviceCapabilities = tizen.systeminfo.getCapabilities();
+if (deviceCapabilities.bluetooth)
+{
+ console.log("Bluetooth is supported");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getCapability">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> try {
- // Checks if a device supports bluetooth API or not
- var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
- console.log(" Bluetooth = " + bluetooth);
- } catch (error) {
- console.log("Error name: " + error.name + ", message: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+try
+{
+ /* Checks if a device supports bluetooth API */
+ var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
+ console.log(" Bluetooth = " + bluetooth);
+}
+catch (error)
+{
+ console.log("Error name: " + error.name + ", message: " + error.message);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getCount">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var count = tizen.systeminfo.getCount("SIM");
- if (count === 0) {
- console.log("There is no available SIM card.");
- } else {
- console.log("There is(are) " + count + " SIM card(s) available.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var count = tizen.systeminfo.getCount("SIM");
+if (count === 0)
+{
+ console.log("There is no available SIM card.");
+}
+else
+{
+ console.log("There is(are) " + count + " SIM card(s) available.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getPropertyValue">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cpu) {
- console.log("The cpu load is " + cpu.load);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cpu)
+{
+ console.log("The cpu load is " + cpu.load);
+}
- function onErrorCallback(error) {
- console.log("An error occurred " + error.message);
- }
+function onErrorCallback(error)
+{
+ console.log("An error occurred " + error.message);
+}
- tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
- </pre>
+tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
+</pre>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cellular) {
- console.log("The status of the cellular network is " + cellular.status);
- }
-
- function onErrorCallback(error) {
- console.log("An error occurred " + error.message);
- // if telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError would be passed.
- }
-
- var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
-
- if (telephony_capability === true) {
- // onSuccessCallback will be invoked.
- tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
- } else {
- console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cellular)
+{
+ console.log("The status of the cellular network is " + cellular.status);
+}
+
+function onErrorCallback(error)
+{
+ console.log("An error occurred " + error.message);
+ /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
+}
+
+var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
+
+if (telephony_capability === true)
+{
+ /* onSuccessCallback will be invoked */
+ tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
+}
+else
+{
+ console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::getPropertyValueArray">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function successCB(property) {
- console.log("The SIM's current state is " + property.state);
- }
-
- function successArrayCB(properties) {
- console.log("The number of the returned system properties is " + properties.length);
- for (var i = 0; i < properties.length; i++) {
- console.log("[" + i + "] SIM's state is " + properties[i].state);
- }
- }
-
- var count = tizen.systeminfo.getCount("SIM");
- if (count === 0) {
- console.log("This device does not provide SIM card.");
- } else if (count > 1) {
- tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
- } else {
- tizen.systeminfo.getPropertyValue("SIM", successCB);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function successCB(property)
+{
+ console.log("The SIM's current state is " + property.state);
+}
+
+function successArrayCB(properties)
+{
+ console.log("The number of the returned system properties is " + properties.length);
+ for (var i = 0; i < properties.length; i++)
+ {
+ console.log("[" + i + "] SIM's state is " + properties[i].state);
+ }
+}
+
+var count = tizen.systeminfo.getCount("SIM");
+if (count === 0)
+{
+ console.log("This device does not provide SIM card.");
+}
+else if (count > 1)
+{
+ tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
+}
+else
+{
+ tizen.systeminfo.getPropertyValue("SIM", successCB);
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::addPropertyValueChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccessCallback(cpu) {
- console.log("The cpu load : " + cpu.load);
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccessCallback(cpu)
+{
+ console.log("The cpu load: " + cpu.load);
+}
- tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold : 0.2});
- </pre>
+tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2});
+</pre>
</div>
</dd>
<dt class="method" id="SystemInfo::addPropertyValueArrayChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var id = null;
- function onSuccessCallback(cpu) {
- console.log("New value for CPU load is " + cpu.load);
- if (id != null) { // After receiving the first notification, we clear it
- tizen.systeminfo.removePropertyValueChangeListener(id);
- }
- }
-
- id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var id = null;
+function onSuccessCallback(cpu)
+{
+ console.log("New value for CPU load is " + cpu.load);
+ if (id != null)
+ {
+ /* After receiving the first notification, clear it */
+ tizen.systeminfo.removePropertyValueChangeListener(id);
+ }
+}
+
+id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.systeminfo.getPropertyValue("CAMERA_FLASH",
- function (flash) {
- console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
- },
- function (error) {
- console.log("Error, name: " + error.name + ", message: " + error.message);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
+{
+ console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
+}, function(error)
+{
+ console.log("Error, name: " + error.name + ", message: " + error.message);
+});
+</pre>
</div>
</li>
<li class="attribute" id="SystemInfoCameraFlash::camera">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.systeminfo.getPropertyValue("CAMERA_FLASH",
- function (flash) {
- try {
- flash.setBrightness(1);
- } catch (error) {
- console.log("Setting flash brightness failed: " + error.message);
- }
- },
- function (error) {
- console.log("Error, name: " + error.name + ", message: " + error.message);
- }
- );
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
+{
+ try
+ {
+ flash.setBrightness(1);
+ }
+ catch (error)
+ {
+ console.log("Setting flash brightness failed: " + error.message);
+ }
+}, function(error)
+{
+ console.log("Error, name: " + error.name + ", message: " + error.message);
+});
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Checks whether SystemSetting API is supported.
- var systemsetting_api_supported = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Checks whether SystemSetting API is supported */
+var systemsetting_api_supported = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting");
- // Checks whether the picture on home screen can be changed or retrieved through SystemSetting API.
- var home_screen_system_setting = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen");
+/* Checks whether the picture on home screen can be changed or retrieved through SystemSetting API */
+var home_screen_system_setting = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen");
- // Defines the success callback.
- function successCallback() {
- console.log("Succeeded in changing the property");
- }
+/* Defines the success callback */
+function successCallback()
+{
+ console.log("Succeeded in changing the property");
+}
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Failed to change the property. Error : " + error.message);
- }
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Failed to change the property. Error: " + error.message);
+}
- if (systemsetting_api_supported === true) {
- // tizen.systemsetting will be available.
- if (home_screen_system_setting === true) {
- // Sets the home screen image.
- // The newHomeScreenImagePath variable should hold the path of the image to be set as home screen background
- tizen.systemsetting.setProperty("HOME_SCREEN", newHomeScreenImagePath, successCallback, errorCallback);
- } else {
- // if tizen.systemsetting.setProperty("HOME_SCREEN", ..) is invoked, NotSupportedError would be returned through ErrorCallback.
- }
- } else {
- // tizen.systemsetting will be 'undefined'.
- console.log("SystemSetting API is not supported on the device.");
- }
-
- </pre>
+if (systemsetting_api_supported === true)
+{
+ /* tizen.systemsetting will be available */
+ if (home_screen_system_setting === true)
+ {
+ /* Sets the home screen image */
+ /* newHomeScreenImagePath variable should hold the path of the image to be set as home screen background */
+ tizen.systemsetting.setProperty("HOME_SCREEN", newHomeScreenImagePath, successCallback, errorCallback);
+ }
+ else
+ {
+ /* if tizen.systemsetting.setProperty("HOME_SCREEN", ..) is invoked, NotSupportedError is returned through ErrorCallback */
+ }
+}
+else
+{
+ /* tizen.systemsetting will be 'undefined' */
+ console.log("SystemSetting API is not supported on the device.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="SystemSettingManager::getProperty">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Defines the success callback
- function getPropertySuccessCallback(value) {
- // the case : tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen") returns 'true'.
- console.log("Succeeded in retrieving the property. The value is " + value);
- }
-
- // Defines the error callback.
- function errorCallback(error) {
- console.log("Failed to get the property. Error : " + error.message);
- // If the device does not support to get the image on home screen, NotSupportedError would be thrown.
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the success callback */
+function getPropertySuccessCallback(value)
+{
+ /* Case: tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen") returns 'true' */
+ console.log("Succeeded in retrieving the property. The value is " + value);
+}
- tizen.systemsetting.getProperty("HOME_SCREEN", getPropertySuccessCallback, errorCallback);
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("Failed to get the property. Error: " + error.message);
+ /* If the device does not support to get the image on home screen, NotSupportedError is thrown */
+}
- </pre>
+tizen.systemsetting.getProperty("HOME_SCREEN", getPropertySuccessCallback, errorCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var current_dt = tizen.time.getCurrentDateTime();
+console.log("current date/time is " + current_dt.toLocaleString());
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getLocalTimezone">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> console.log("The local time zone is " + tizen.time.getLocalTimezone());
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+console.log("The local time zone is " + tizen.time.getLocalTimezone());
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getAvailableTimezones">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var tzids = tizen.time.getAvailableTimezones();
- console.log("The device supports " + tzids.length + " time zones.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var tzids = tizen.time.getAvailableTimezones();
+console.log("The device supports " + tzids.length + " time zones.");
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::getDateFormat">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var current_dt = tizen.time.getCurrentDateTime();
- var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
- if (is_leap) {
- console.log("This year is a leap year.");
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var current_dt = tizen.time.getCurrentDateTime();
+var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
+if (is_leap)
+{
+ console.log("This year is a leap year.");
+}
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::setDateTimeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
-
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setDateTimeChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setDateTimeChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::unsetDateTimeChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- tizen.time.unsetDateTimeChangeListener();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setDateTimeChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ tizen.time.unsetDateTimeChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setDateTimeChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::setTimezoneChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- // The new time zone can be retrieved through tizen.time.getLocalTimezone()
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setTimezoneChangeListener(changedCallback);
-
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setTimezoneChangeListener(changedCallback);
+</pre>
</div>
</dd>
<dt class="method" id="TimeUtil::unsetTimezoneChangeListener">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var changedCallback = function() {
- try {
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- tizen.time.unsetTimezoneChangeListener();
- } catch (err) {
- console.log (err.name + ": " + err.message);
- }
- };
-
- tizen.time.setTimezoneChangeListener(changedCallback);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var changedCallback = function()
+{
+ try
+ {
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ tizen.time.unsetTimezoneChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+};
+
+tizen.time.setTimezoneChangeListener(changedCallback);
+</pre>
</div>
</dd>
</dl>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var now = tizen.time.getCurrentDateTime();
- var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var now = tizen.time.getCurrentDateTime();
+var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::toLocaleDateString">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
- var myDate = new Date();
- var exp_offset = myDate.getTimezoneOffset()*60;
- //offset is equals to exp_offset.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
+var myDate = new Date();
+var exp_offset = myDate.getTimezoneOffset() * 60;
+/* offset is equal to exp_offset */
+</pre>
</div>
</dd>
<dt class="method" id="TZDate::isDST">
1.0
</p>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var now = tizen.time.getCurrentDateTime();
- var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); // Becomes tomorrow, same time.
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var now = tizen.time.getCurrentDateTime();
+var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); /* Becomes tomorrow, same time */
+</pre>
</div>
<div class="constructors">
<h4 id="TimeDuration::constructor">Constructors</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Assume that event1 and event2 are tizen.CalendarEvent objects.
- // Computes event1.duration - event2.duration
- var diff = event1.duration.difference(event2.duration);
- if (diff.length > 0)
- console.log("The event1 is longer than event2.");
- else if (diff.length == 0)
- console.log("The duration of two events is same.");
- else
- console.log("The event1 is shorter than the event2.");
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Assume that event1 and event2 are tizen.CalendarEvent objects */
+/* Computes event1.duration - event2.duration */
+var diff = event1.duration.difference(event2.duration);
+if (diff.length > 0)
+ console.log("The event1 is longer than event2.");
+else if (diff.length == 0)
+ console.log("The duration of two events is same.");
+else
+ console.log("The event1 is shorter than the event2.");
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::equalsTo">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(60, "MINS"); // 60 minutes
- var d2 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var ret = d1.equalsTo(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(60, "MINS"); /* 60 minutes */
+var d2 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var ret = d1.equalsTo(d2); /* Returns true */
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::lessThan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var d2 = new tizen.TimeDuration(120, "MINS"); // 120 minutes
- var ret = d1.lessThan(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var d2 = new tizen.TimeDuration(120, "MINS"); /* 120 minutes */
+var ret = d1.lessThan(d2); /* Returns true */
+</pre>
</div>
</dd>
<dt class="method" id="TimeDuration::greaterThan">
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var d1 = new tizen.TimeDuration(120, "MINS"); // 120 minutes
- var d2 = new tizen.TimeDuration(1, "HOURS"); // 1 hour
- var ret = d1.greaterThan(d2); // Returns true
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+var d1 = new tizen.TimeDuration(120, "MINS"); /* 120 minutes */
+var d2 = new tizen.TimeDuration(1, "HOURS"); /* 1 hour */
+var ret = d1.greaterThan(d2); /* Returns true */
+</pre>
</div>
</dd>
</dl>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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");
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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 errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function findCB(contents) {
- console.log('The Joshua Tree :' + contents.length);
- }
+function findCB(contents)
+{
+ console.log('The Joshua Tree:' + contents.length);
+}
- tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
- </pre>
+tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
+</pre>
</div>
<div class="constructors">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> 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);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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 errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function findCB(contents) {
- console.log('The contents modified today :' + contents.length);
- }
+function findCB(contents)
+{
+ console.log('The contents modified today:' + contents.length);
+}
- tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
- </pre>
+tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
+</pre>
</div>
<div class="constructors">
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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]);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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 errorCB(err)
+{
+ console.log('The following error occurred: ' + err.name);
+}
- function findCB(contents) {
- console.log('The Joshua Tree by U2:' + contents.length);
- }
+function findCB(contents)
+{
+ console.log('The Joshua Tree by U2:' + contents.length);
+}
- tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
- </pre>
+tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
+</pre>
</div>
<div class="constructors">
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // 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]);
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* 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 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 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);
- }
- }
+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);
- </pre>
+tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
+</pre>
</div>
<div class="constructors">
<h4 id="SortMode::constructor">Constructors</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> function onSuccess() {
- console.log("Application launched successfully");
- }
- tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function onSuccess()
+{
+ console.log("Application launched successfully");
+}
+tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</p>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> // Define the error callback.
- function onerror(error) {
- console.log(error.message);
- }
- function onsuccess() {
- console.log("The application has launched successfully");
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Define the error callback */
+function onerror(error)
+{
+ console.log(error.message);
+}
- tizen.application.launch("targetApp0.main", onsuccess, onerror);
- </pre>
+function onsuccess()
+{
+ console.log("The application has launched successfully");
+}
+
+tizen.application.launch("targetApp0.main", onsuccess, onerror);
+</pre>
</div>
<div class="methods">
<h4>Methods</h4>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- console.log("Widget id is " + myWidget.id);
- console.log("Widget details:");
- console.log("Main application id: " + myWidget.applicationId);
- console.log("Package id: " + myWidget.packageId);
- console.log("Is hidden in the list of widgets: " + myWidget.noDisplay);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ console.log("Widget id is " + myWidget.id);
+ console.log("Widget details:");
+ console.log("Main application id: " + myWidget.applicationId);
+ console.log("Package id: " + myWidget.packageId);
+ console.log("Is hidden in the list of widgets: " + myWidget.noDisplay);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Widget id is org.tizen.gallery.widget
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> tizen.widgetservice.getWidgets(function (widgets) {
- console.log("There are " + widgets.length + " available widgets");
- }, function (error) {
- console.log("Error: " + error.message);
- });
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+tizen.widgetservice.getWidgets(function(widgets)
+{
+ console.log("There are " + widgets.length + " available widgets");
+}, function(error)
+{
+ console.log("Error: " + error.message);
+});
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> There are 3 available widgets
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable id should contain valid id of the application or package.
- var id = "org.tizen.gallery";
- try {
- var widgetId = tizen.widgetservice.getPrimaryWidgetId(id);
- console.log("Widget id is " + widgetId);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable id should contain valid id of the application or package */
+var id = "org.tizen.gallery";
+try
+{
+ var widgetId = tizen.widgetservice.getPrimaryWidgetId(id);
+ console.log("Widget id is " + widgetId);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Widget id is org.tizen.gallery.widget
</dt>
<dd>
<div class="brief">
- Returns the size coresponding to the given sizeType.
+ Returns the size corresponding to the given sizeType.
</div>
<div class="synopsis"><pre class="signature prettyprint"><a href="#WidgetSize">WidgetSize</a> getSize(<a href="#WidgetSizeType">WidgetSizeType</a> sizeType);
</pre></div>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable sizeType should contain supported size type
- var sizeType = "4x4";
- try {
- var widgetSize = tizen.widgetservice.getSize(sizeType);
- console.log("Widget size width: " + widgetSize.width + ", height: " + widgetSize.height);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable sizeType should contain supported size type */
+var sizeType = "4x4";
+try
+{
+ var widgetSize = tizen.widgetservice.getSize(sizeType);
+ console.log("Widget size width: " + widgetSize.width + ", height: " + widgetSize.height);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Widget size width: 712, height: 712
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- var name = myWidget.getName("en-us");
- console.log("Widget name is " + name);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var name = myWidget.getName("en-us");
+ console.log("Widget name is " + name);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Widget name is Gallery
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> widgetSuccessCb = function(instances) {
- console.log("Instances array size: " + instances.length);
- }
-
- widgetErrorCb = function(error) {
- console.log("Error occurred: " + error.name + ": " + error.message);
- }
-
- //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- myWidget.getInstances(widgetSuccessCb, widgetErrorCb);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+widgetSuccessCb = function(instances)
+{
+ console.log("Instances array size: " + instances.length);
+}
+
+widgetErrorCb = function(error)
+{
+ console.log("Error occurred: " + error.name + ": " + error.message);
+}
+
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ myWidget.getInstances(widgetSuccessCb, widgetErrorCb);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Instances array size: 3
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- var variant = myWidget.getVariant("4x4");
- console.log("Variant preview image path is " + variant.previewImagePath);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var variant = myWidget.getVariant("4x4");
+ console.log("Variant preview image path is " + variant.previewImagePath);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Variant preview image path is /usr/share/icons/default/small/preview_gallery_4x4.png
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> widgetSuccessCb = function(variants) {
- console.log("Variants array size: " + variants.length);
- }
-
- widgetErrorCb = function(error) {
- console.log("Error occurred: " + error.name + ": " + error.message);
- }
-
- //variable id should contain valid id of the installed widget
- var id = "org.tizen.gallery.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- myWidget.getVariants(widgetSuccessCb, widgetErrorCb);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+widgetSuccessCb = function(variants)
+{
+ console.log("Variants array size: " + variants.length);
+}
+
+widgetErrorCb = function(error)
+{
+ console.log("Error occurred: " + error.name + ": " + error.message);
+}
+
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.gallery.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ myWidget.getVariants(widgetSuccessCb, widgetErrorCb);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Variants array size: 4
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> widgetChangeCb = function(instance, event) {
- console.log("Instance " + instance.id + " is " + event);
- }
-
- //variable id should contain valid id of the installed widget
- var id = "org.tizen.music-player.widget";
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- var watchId = myWidget.addStateChangeListener(widgetChangeCb);
- console.log("Listener with id " + watchId + " has been added");
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+widgetChangeCb = function(instance, event)
+{
+ console.log("Instance " + instance.id + " is " + event);
+}
+
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.music-player.widget";
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var watchId = myWidget.addStateChangeListener(widgetChangeCb);
+ console.log("Listener with id " + watchId + " has been added");
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Listener with id 1 has been added.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> widgetChangeCb = function(instance, event) {
- console.log("Instance " + instance.id + " is " + event);
- myWidget.removeStateChangeListener(watchId);
- console.log("Listener with id " + watchId + " has been removed");
- }
-
- //variable id should contain valid id of the installed widget
- var id = "org.tizen.music-player.widget";
- var watchId;
-
- try {
- var myWidget = tizen.widgetservice.getWidget(id);
- watchId = myWidget.addStateChangeListener(widgetChangeCb);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+widgetChangeCb = function(instance, event)
+{
+ console.log("Instance " + instance.id + " is " + event);
+ myWidget.removeStateChangeListener(watchId);
+ console.log("Listener with id " + watchId + " has been removed");
+}
+
+/* Variable id should contain valid id of the installed widget */
+var id = "org.tizen.music-player.widget";
+var watchId;
+
+try
+{
+ var myWidget = tizen.widgetservice.getWidget(id);
+ watchId = myWidget.addStateChangeListener(widgetChangeCb);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Listener with id 1 has been removed.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable instance should contain valid WidgetInstance object obtained by getInstances() method.
- var instance;
- var period = 2;
-
- try {
- instance.changeUpdatePeriod(period);
- console.log("Update period has been set to " + period + " seconds");
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable instance should contain valid WidgetInstance object obtained by getInstances() method */
+var instance;
+var period = 2;
+
+try
+{
+ instance.changeUpdatePeriod(period);
+ console.log("Update period has been set to " + period + " seconds");
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Update period has been set to 2 seconds.
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable instance should contain valid WidgetInstance object obtained by getInstances() method.
- var instance;
-
- var data = {
- data1 : 'test1',
- data2 : 'test2'
- };
-
- try {
- instance.sendContent(data, true);
- console.log("Data has been successfully sent");
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable instance should contain valid WidgetInstance object obtained by getInstances() method */
+var instance;
+
+var data =
+{
+ data1: 'test1',
+ data2: 'test2'
+};
+
+try
+{
+ instance.sendContent(data, true);
+ console.log("Data has been successfully sent");
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Data has been successfully sent
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> //variable instance should contain valid WidgetInstance object obtained by getInstances() method.
- var instance;
-
- contentSuccessCb = function(data) {
- console.log("Data has been obtained successfully");
- for (var prop in data) {
- console.log(prop + " : " + data[prop]);
- }
- }
-
- contentErrorCb = function(error) {
- console.log("Error occurred: " + error.name + ":" + error.message);
- }
-
- try {
- instance.getContent(contentSuccessCb, contentErrorCb);
- } catch (error) {
- console.log("Error: " + error.message);
- }
- </pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Variable instance should contain valid WidgetInstance object obtained by getInstances() method */
+var instance;
+
+contentSuccessCb = function(data)
+{
+ console.log("Data has been obtained successfully");
+ for (var prop in data)
+ {
+ console.log(prop + ": " + data[prop]);
+ }
+}
+
+contentErrorCb = function(error)
+{
+ console.log("Error occurred: " + error.name + ":" + error.message);
+}
+
+try
+{
+ instance.getContent(contentSuccessCb, contentErrorCb);
+}
+catch (error)
+{
+ console.log("Error: " + error.message);
+}
+</pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Data has been obtained successfully
- data1 : test1
- data2 : test2
+ data1: test1
+ data2: test2
</pre>
</div>
</dd>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-stop">stop</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-stop">stop</a>() </pre>
</td>
<td><p>Stops animation or group animations.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-transform">transform</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-transform">transform</a>() </pre>
</td>
<td><p>Sets transform property of target.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-tween">tween</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-tween">tween</a>() </pre>
</td>
<td><p>Adds tween animation with animation information and target is animated.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Target <a href="#method-target">target</a> ( String str ) </pre>
+ <pre class="intable prettyprint">Target <a href="#method-target">target</a>(String str) </pre>
</td>
<td><p>Returns animation target object</p></td>
</tr>
<p>Stops animation or group animations.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">stop ( ) </pre>
+ <pre class="signature prettyprint">stop()</pre>
</div>
<div class="description">
<p>Sets transform property of target.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">transform ( ) </pre>
+ <pre class="signature prettyprint">transform()</pre>
</div>
<div class="description">
<p>Adds tween animation with animation information and target is animated.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">tween ( ) </pre>
+ <pre class="signature prettyprint">tween()</pre>
</div>
<div class="description">
<p>Returns animation target object</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Target target ( String str) </pre>
+ <pre class="signature prettyprint">Target target(String str)</pre>
</div>
<div class="description">
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><!--HTML code-->
<div id="1btnPopup" class="ui-popup">
- <div class="ui-popup-header">Power saving mode</div>
- <div class="ui-popup-content">
- </div>
- <div class="ui-popup-footer">
+ <div class="ui-popup-header">Power saving mode</div>
+ <div class="ui-popup-content"></div>
+ <div class="ui-popup-footer">
<button id="1btnPopup-cancel" class="ui-btn">Cancel</button>
</div>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><!--Popup html code-->
<div id="popup" class="ui-popup">
- <div class="ui-popup-header"></div>
- <div class="ui-popup-content"></div>
- </div>
-</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
+ <div class="ui-popup-header"></div>
+ <div class="ui-popup-content"></div>
+</div>
+</pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<script>
/* Use popup events */
var popup = document.getElementById("popup");
<pre class="prettyprint">
<div class="ui-page ui-page-active" id="pageDrag">
- <header class="ui-header">
- <h2 class="ui-title">Drag Event</h2>
- </header>
- <div id="content" class="ui-content content-padding"></div>
+ <header class="ui-header">
+ <h2 class="ui-title">Drag Event</h2>
+ </header>
+ <div id="content" class="ui-content content-padding"></div>
</div>
</pre>
<h3>Javascript</h3>
<pre class="prettyprint">
-(function() {
- var page = document.getElementById("pageDrag");
- page.addEventListener("pagebeforeshow", function() {
- var content = document.getElementById("content");
- tau.event.enableGesture(content, new tau.event.gesture.Drag({
- blockVertical: true
- }));
-
- content.addEventListener("dragstart", function(e) {
- console.log("drag start");
- });
-
- content.addEventListener("drag", function(e) {
- console.log("direction = " + e.detail.direction);
- });
-
- content.addEventListener("dragend", function(e) {
- console.log("drag end");
- });
- });
+(function()
+{
+ var page = document.getElementById("pageDrag");
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var content = document.getElementById("content");
+ tau.event.enableGesture(content, new tau.event.gesture.Drag(
+ {
+ blockVertical: true
+ }));
+
+ content.addEventListener("dragstart", function(e)
+ {
+ console.log("drag start");
+ });
+
+ content.addEventListener("drag", function(e)
+ {
+ console.log("direction = " + e.detail.direction);
+ });
+
+ content.addEventListener("dragend", function(e)
+ {
+ console.log("drag end");
+ });
+ });
}());
</pre>
<pre class="prettyprint">
/* element is your event target element */
tau.event.enableGesture(element, new tau.event.gesture.Drag(), new tau.event.gesture.Swipe());
-element.addEventListener("drag", function(e) {
- console.log("drag event fired");
+element.addEventListener("drag", function(e)
+{
+ console.log("drag event fired");
});
-element.addEventListener("swipe", function(e) {
- console.log("swipe event fired");
+element.addEventListener("swipe", function(e)
+{
+ console.log("swipe event fired");
});
</pre>
<pre class="prettyprint">
<div class="ui-page ui-page-active" id="pageSwipe">
- <header class="ui-header">
- <h2 class="ui-title">Swipe Event</h2>
- </header>
- <div id="content" class="ui-content content-padding"></div>
+ <header class="ui-header">
+ <h2 class="ui-title">Swipe Event</h2>
+ </header>
+ <div id="content" class="ui-content content-padding"></div>
</div>
</pre>
<h3>Javascript</h3>
<pre class="prettyprint">
-(function() {
- var page = document.getElementById("pageSwipe");
- page.addEventListener("pagebeforeshow", function() {
- var content = document.getElementById("content");
- tau.event.enableGesture(content, new tau.event.gesture.Swipe( {
- orientation: "horizontal"
- }));
+(function()
+{
+ var page = document.getElementById("pageSwipe");
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var content = document.getElementById("content");
+ tau.event.enableGesture(content, new tau.event.gesture.Swipe(
+ {
+ orientation: "horizontal"
+ }));
- content.addEventListener("swipe", function(e) {
- console.log("swipe direction = " + e.detail.direction);
- });
- });
+ content.addEventListener("swipe", function(e)
+ {
+ console.log("swipe direction = " + e.detail.direction);
+ });
+ });
}());
</pre>
<tr>
<td>
- <pre class="intable prettyprint">Object <a href="#method-getCalendar">getCalendar</a> ( ) </pre>
+ <pre class="intable prettyprint">Object <a href="#method-getCalendar">getCalendar</a>()</pre>
</td>
<td><p>Get gregorian calendar.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">string <a href="#method-getLocale">getLocale</a> ( ) </pre>
+ <pre class="intable prettyprint">string <a href="#method-getLocale">getLocale</a>()</pre>
</td>
<td><p>Get Locale.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-importModule">importModule</a> ( string fileName ) </pre>
+ <pre class="intable prettyprint"><a href="#method-importModule">importModule</a>(string fileName) </pre>
</td>
<td><p>Put the module into module array of core.util.globalize</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Deferred <a href="#method-setLocale">setLocale</a> ( string localeId ) </pre>
+ <pre class="intable prettyprint">Deferred <a href="#method-setLocale">setLocale</a>(string localeId) </pre>
</td>
- <td><p>Set Locale. This API is Async API.<br />Please use deferred callback functions which are returned( .done(), .then() .etc)</p></td>
+ <td><p>Set Locale. This API is Async API.<br />Please use deferred callback functions which are returned (.done(), .then() .etc)</p></td>
</tr>
<p>Get gregorian calendar.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Object getCalendar ( ) </pre>
+ <pre class="signature prettyprint">Object getCalendar() </pre>
</div>
<div class="description">
<p>Get Locale.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">string getLocale ( ) </pre>
+ <pre class="signature prettyprint">string getLocale() </pre>
</div>
<div class="description">
<p>Put the module into module array of core.util.globalize</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">importModule ( string fileName) </pre>
+ <pre class="signature prettyprint">importModule(string fileName) </pre>
</div>
<div class="description">
id="method-setLocale">setLocale</span></b></code></dt>
<dd>
<div class="brief">
- <p>Set Locale. This API is Async API.<br />Please use deferred callback functions which are returned( .done(), .then() .etc)</p>
+ <p>Set Locale. This API is Async API.<br />Please use deferred callback functions which are returned (.done(), .then() .etc)</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Deferred setLocale ( string localeId) </pre>
+ <pre class="signature prettyprint">Deferred setLocale(string localeId) </pre>
</div>
<div class="description">
<p>To create a checkbox radio component:</p>
-<pre class="prettyprint"><input type="checkbox" name="checkbox-yes" id="checkbox-yes" />
+<pre class="prettyprint"><input type="checkbox" name="checkbox-yes" id="checkbox-yes"/>
<label for="checkbox-yes">Yes</label>
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-getCheckedElement">getCheckedElement</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-getCheckedElement">getCheckedElement</a>() </pre>
</td>
<td><p>Returns a checked checkbox radio element.</p></td>
</tr>
<p>Disables the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">disable ( ) </pre>
+ <pre class="signature prettyprint">disable() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="checkbox" name="checkbox-1" id="checkbox-1"/><label for="checkbox-1">Normal</label>
+<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
+<label for="checkbox-1">Normal</label>
<script>
var element = document.getElementById("checkbox-1"),
checkboxWidget = tau.widget.Checkboxradio(element);
<p>Enables the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">enable ( ) </pre>
+ <pre class="signature prettyprint">enable() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="checkbox" name="checkbox-1" id="checkbox-1"/><label for="checkbox-1">Normal</label>
+<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
+<label for="checkbox-1">Normal</label>
<script>
var element = document.getElementById("checkbox-1"),
checkboxWidget = tau.widget.Checkboxradio(element);
<p>Returns a checked checkbox radio element.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">HTMLElement getCheckedElement ( ) </pre>
+ <pre class="signature prettyprint">HTMLElement getCheckedElement() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="checkbox" name="checkbox-1" id="checkbox-1"/><label for="checkbox-1">Normal</label>
+<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
+<label for="checkbox-1">Normal</label>
<script>
var element = document.getElementById("checkbox-1"),
checkboxWidget = tau.widget.Checkboxradio(element);
checkboxWidget.getCheckedElement();
- // Returns checked checkbox element
+ /* Returns checked checkbox element */
</script>
</pre>
</div>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the collapsible component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the collapsible component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-refresh">refresh</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes the collapsible component.</p></td>
</tr>
<p>Disables the collapsible component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Collapsible disable ( ) </pre>
+ <pre class="signature prettyprint">Collapsible disable() </pre>
</div>
<div class="description">
<p>Enables the collapsible component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Collapsible enable ( ) </pre>
+ <pre class="signature prettyprint">Collapsible enable() </pre>
</div>
<div class="description">
<p>Refreshes the collapsible component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Collapsible refresh ( ) </pre>
+ <pre class="signature prettyprint">Collapsible refresh() </pre>
</div>
<div class="description">
<tbody>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-destroy">destroy</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-destroy">destroy</a>() </pre>
</td>
<td><p>Destroys the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">string <a href="#method-indexString">indexString</a> ( string? indexAlphabet ) </pre>
+ <pre class="intable prettyprint">string <a href="#method-indexString">indexString</a>(string? indexAlphabet) </pre>
</td>
<td><p>Gets or sets an index string.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-refresh">refresh</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes the component.</p></td>
</tr>
<p>Destroys the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">destroy ( )</pre>
+ <pre class="signature prettyprint">destroy()</pre>
</div>
<p><span class="version">Since: </span>
<p>Gets or sets an index string.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">?string indexString ( string? indexAlphabet) </pre>
+ <pre class="signature prettyprint">?string indexString(string? indexAlphabet) </pre>
</div>
<p><span class="version">Since: </span>
</div>
</div>
<script>
- // Get index string
+ /* Get index string */
var element = document.getElementById("fastscroll"),
fastscroll = tau.widget.FastScroll(element, {fastscroll: true});
fastscroll.indexString();
- // Set index string
+ /* Set index string */
fastscroll.indexString("A,D,J,P,W,Z");
</script>
</pre>
<p>Refreshes the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">refresh ( ) </pre>
+ <pre class="signature prettyprint">refresh() </pre>
</div>
<p><span class="version">Since: </span>
<tbody>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-add">add</a> ( string file ) </pre>
+ <pre class="intable prettyprint"><a href="#method-add">add</a>(string file) </pre>
</td>
<td><p>Adds an image to the gallery.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-empty">empty</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-empty">empty</a>() </pre>
</td>
<td><p>Removes all images from the gallery.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-hide">hide</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-hide">hide</a>() </pre>
</td>
<td><p>Hides the gallery.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">number <a href="#method-length">length</a> ( ) </pre>
+ <pre class="intable prettyprint">number <a href="#method-length">length</a>() </pre>
</td>
<td><p>Gets the number of images.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">?number <a href="#method-refresh">refresh</a> ( number? startIndex ) </pre>
+ <pre class="intable prettyprint">?number <a href="#method-refresh">refresh</a>(number? startIndex) </pre>
</td>
<td><p>Refreshes the gallery.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-remove">remove</a> ( number? index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-remove">remove</a>(number? index) </pre>
</td>
<td><p>Deletes a specific image from the gallery.<br />If no parameter is defined, the current image is deleted.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-show">show</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-show">show</a>() </pre>
</td>
<td><p>Displays the gallery.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">?number <a href="#method-value">value</a> ( number index ) </pre>
+ <pre class="intable prettyprint">?number <a href="#method-value">value</a>(number index) </pre>
</td>
<td><p>Gets or sets the current index of the gallery.</p></td>
</tr>
<p>Adds an image to the gallery.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">add ( string file) </pre>
+ <pre class="signature prettyprint">add(string file) </pre>
</div>
<div class="description">
prettyprint">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery"));
-galleryWidget.add("./images/01.jpg"); // Image with attribute src="./images/01.jpg" is added
+galleryWidget.add("./images/01.jpg"); /* Image with attribute src="./images/01.jpg" is added */
galleryWidget.refresh();
</pre>
</div>
prettyprint">
$("#gallery").gallery("add", "./images/01.jpg");
$("#gallery").gallery("add", "./images/02.jpg");
-$("#gallery").gallery("refresh"); // To see changes, "refresh" method must be called
+$("#gallery").gallery("refresh"); /* To see changes, "refresh" method must be called */
</pre>
</div>
Removes all images from the gallery.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">empty ( ) </pre>
+ <pre class="signature prettyprint">empty() </pre>
</div>
<div class="description">
prettyprint">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery"));
-galleryWidget.empty(); // All images are deleted
+galleryWidget.empty(); /* All images are deleted */
</pre>
</div>
<div class="example">
<p>Hides the gallery.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">hide ( ) </pre>
+ <pre class="signature prettyprint">hide() </pre>
</div>
<div class="description">
prettyprint">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery"));
-galleryWidget.hide(); // Gallery is hidden
+galleryWidget.hide(); /* Gallery is hidden */
</pre>
</div>
<div class="example">
<p>Gets the number of images.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">number length ( ) </pre>
+ <pre class="signature prettyprint">number length() </pre>
</div>
<div class="description">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery")),
imagesItems;
-imagesLength = galleryWidget.length(); // Number of images
+imagesLength = galleryWidget.length(); /* Number of images */
</pre>
</div>
<div class="example">
<p>Refreshes the gallery.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">?number refresh ( number? startIndex) </pre>
+ <pre class="signature prettyprint">?number refresh(number? startIndex) </pre>
</div>
<div class="description">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery"));
galleryWidget.refresh();
-// Called automatically during option changing (option method) or value setting (value method)
+/* Called automatically during option changing (option method) or value setting (value method) */
galleryWidget.option("flicking", true);
galleryWidget.value(0);
prettyprint">
$("#gallery").gallery("refresh");
-// Called automatically during option changing (option method) or value setting (value method)
+/* Called automatically during option changing (option method) or value setting (value method) */
galleryWidget.option("flicking", true);
galleryWidget.value(0);
<p>Deletes a specific image from the gallery.<br />If no parameter is defined, the current image is deleted.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">remove ( number? index) </pre>
+ <pre class="signature prettyprint">remove(number? index) </pre>
</div>
<div class="description">
prettyprint">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery"));
-galleryWidget.remove(0); // First image is removed
+galleryWidget.remove(0); /* First image is removed */
</pre>
</div>
<div class="example">
<p>Displays the gallery.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">show ( ) </pre>
+ <pre class="signature prettyprint">show() </pre>
</div>
<div class="description">
<p>Gets or sets the current index of the gallery.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">?number value ( number index) </pre>
+ <pre class="signature prettyprint">?number value(number index) </pre>
</div>
<div class="description">
<pre name="code" class="examplecode
prettyprint">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery")),
- value = galleryWidget.value(); // Value contains the index of the current image
+ value = galleryWidget.value(); /* Value contains the index of the current image */
-galleryWidget.value(0); // First image is displayed
+galleryWidget.value(0); /* First image is displayed */
</pre>
</div>
<div class="example">
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-value = $("#gallery").gallery("value"); // Value contains the index of the current image
+value = $("#gallery").gallery("value"); /* Value contains the index of the current image */
-$("#gallery").gallery("value", 0); // First image is displayed
+$("#gallery").gallery("value", 0); /* First image is displayed */
</pre>
</div>
<pre class="prettyprint">
<div data-role="content">
<video data-controls="true" style="width:100%;" controls>
- <source src="Color_short_version.mp4" type="video/mp4" />
+ <source src="Color_short_version.mp4" type="video/mp4"/>
<p>Your browser does not support the video tag.</p>
</video>
</div>
<pre class="prettyprint">
<div data-role="content">
<audio data-controls="true" style="width:100%;" controls>
- <source src="Color_short_version.mp3" type="audio/mpeg" />
+ <source src="Color_short_version.mp3" type="audio/mpeg"/>
<p>Your browser does not support the audio tag.</p>
</audio>
</div>
<p>Line of message</p>
</div>
<script>
- // Get component instance or create new instance if component does not exist
+ /* Get component instance or create new instance if component does not exist */
var notification = tau.widget.Notification(document.getElementById("notification"));
- // Open notification
+ /* Open notification */
notification.open();
</script>
</pre>
<p>Line of message</p>
</div>
<script>
- // Open component using jQuery notation
+ /* Open component using jQuery notation */
$("#notification").notification("open")
</script>
</pre>
<p>Second line of message</p>
</div>
<script>
- // Get component instance or create new instance if component does not exist
+ /* Get component instance or create new instance if component does not exist */
var notification = tau.widget.Notification(document.getElementById("notification"));
- // Open notification
+ /* Open notification */
notification.open();
</script>
</pre>
<p>Second line of message</p>
</div>
<script>
- // Open component using jQuery notation
+ /* Open component using jQuery notation */
$("#notification").notification("open")
</script>
</pre>
<p>To create a ticker notification with an icon using the TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker">
- <img src="icon.png">
+ <img src="icon.png"/>
<p>First line of message</p>
<p>Second line of message</p>
</div>
<script>
- // Open notification
+ /* Open notification */
notification.open();
</script>
</pre>
<p>To create a ticker notification with an icon using the jQuery API (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker">
- <img src="icon.png">
+ <img src="icon.png"/>
<p>First line of message</p>
<p>Second line of message</p>
</div>
<script>
- // Open component using jQuery notation
+ /* Open component using jQuery notation */
$("#notification").notification("open")
</script>
</pre>
<p>To create a notification with an interval using the TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker" data-interval="4000">
- <img src="icon.png">
+ <img src="icon.png"/>
<p>I will close in 4* seconds!</p>
<p>* starts counting from component opening</p>
</div>
<script>
- // Get component instance or create new instance if component does not exist
+ /* Get component instance or create new instance if component does not exist */
var notification = tau.widget.Notification(document.getElementById("notification"));
- // Open notification
+ /* Open notification */
notification.open();
</script>
</pre>
<p>To create a notification with an interval using the jQuery API (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker" data-interval="4000">
- <img src="icon.png">
+ <img src="icon.png"/>
<p>I will close in 4* seconds!</p>
<p>* starts counting from component opening</p>
</div>
<script>
- // Open component using jQuery notation
+ /* Open component using jQuery notation */
$("#notification").notification("open")
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-close">close</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Closes the notification on the screen.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-destroy">destroy</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-destroy">destroy</a>() </pre>
</td>
<td><p>Removes the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-icon">icon</a> ( string src ) </pre>
+ <pre class="intable prettyprint"><a href="#method-icon">icon</a>(string src) </pre>
</td>
<td><p>Creates an icon or changes an existing icon to a new one.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-open">open</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Displays the notification on the screen.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Notification <a href="#method-refresh">refresh</a> ( ) </pre>
+ <pre class="intable prettyprint">Notification <a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes the notification and resets its interval, if specified.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Array <a href="#method-text">text</a> ( string text0, string text1 ) </pre>
+ <pre class="intable prettyprint">Array <a href="#method-text">text</a>(string text0, string text1) </pre>
</td>
<td><p>Gets or sets the notification text.</p></td>
</tr>
<p>Closes the notification on the screen.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">close ( ) </pre>
+ <pre class="signature prettyprint">close() </pre>
</div>
<div class="description">
<p>Removes the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">destroy ( ) </pre>
+ <pre class="signature prettyprint">destroy() </pre>
</div>
<div class="description">
<p>Disables the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">disable ( ) </pre>
+ <pre class="signature prettyprint">disable() </pre>
</div>
<div class="description">
<p>Line of message</p>
</div>
<script>
- // Get component instance or create new instance if component does not exist
+ /* Get component instance or create new instance if component does not exist */
var notification = tau.widget.Notification(document.getElementById("notification"));
- // Disable component
+ /* Disable component */
notification.disable();
</script>
</pre>
<p>Line of message</p>
</div>
<script>
- // Disable component
+ /* Disable component */
$("#notification").notification("disable");
</script>
</pre>
<p>Enables the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">enable ( ) </pre>
+ <pre class="signature prettyprint">enable() </pre>
</div>
<div class="description">
<p>Line of message</p>
</div>
<script>
- // Get component instance or create new instance if component does not exist
+ /* Get component instance or create new instance if component does not exist */
var notification = tau.widget.Notification(document.getElementById("notification"));
- // Enable component
+ /* Enable component */
notification.enable();
</script>
</pre>
<p>Line of message</p>
</div>
<script>
- // Enable component
+ /* Enable component */
$("#notification").notification("enable");
</script>
</pre>
<p>Creates an icon or changes an existing icon to a new one.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">icon ( string src) </pre>
+ <pre class="signature prettyprint">icon(string src) </pre>
</div>
<div class="description">
<p>Displays the notification on the screen.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">open ( ) </pre>
+ <pre class="signature prettyprint">open() </pre>
</div>
<div class="description">
<p>Refreshes the notification and resets its interval, if specified.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Notification refresh ( ) </pre>
+ <pre class="signature prettyprint">Notification refresh() </pre>
</div>
<div class="description">
<p>Gets or sets the notification text.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Array text ( string text0, string text1) </pre>
+ <pre class="signature prettyprint">Array text(string text0, string text1) </pre>
</div>
<div class="description">
var widgetText = notification.text();
alert(widgetText);
- // Alert "Line of message,Second line of message"
+ /* Alert "Line of message,Second line of message" */
</script>
</pre>
</div>
var widgetText = $("#notificationSelector").notification("text");
alert(widgetText);
- // Alert "Line of message,Second line of message"
+ /* Alert "Line of message,Second line of message" */
</script>
</pre>
</div>
<tr>
<td>
- <pre class="intable prettyprint">ProgressBar <a href="#method-refresh">refresh</a> ( ) </pre>
+ <pre class="intable prettyprint">ProgressBar <a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes a progress bar.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">number <a href="#method-value">value</a> ( number? value ) </pre>
+ <pre class="intable prettyprint">number <a href="#method-value">value</a>(number? value) </pre>
</td>
<td><p>Gets or sets a value.</p></td>
</tr>
<p>Refreshes a progress bar.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">ProgressBar refresh ( ) </pre>
+ <pre class="signature prettyprint">ProgressBar refresh() </pre>
</div>
<div class="description">
<p>Gets or sets a value.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">number value ( number? value) </pre>
+ <pre class="signature prettyprint">number value(number? value) </pre>
</div>
<p><span class="version">Since: </span>
<script>
var element = document.getElementById("progress-bar"),
progressBarWidget = tau.widget.ProgressBar(element),
- // Returns current value
+ /* Returns current value */
value = progressBarWidget.value();
- progressBarWidget.value(30); // Sets new value to 30
+ progressBarWidget.value(30); /* Sets new value to 30 */
</script>
</pre>
</div>
<div id="progress-bar"></div>
<script>
$("#progress-bar").progressbar();
- // Returns current value
+ /* Returns current value */
$("#progress-bar").progressbar("value");
- // Sets new value to 30
+ /* Sets new value to 30 */
$("#progress-bar").progressbar("value", 30);
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint">boolean <a href="#method-enableHandler">enableHandler</a> ( boolean enable ) </pre>
+ <pre class="intable prettyprint">boolean <a href="#method-enableHandler">enableHandler</a>(boolean enable) </pre>
</td>
<td><p>Enables or disables the handler.</p></td>
</tr>
<p>Enables or disables the handler.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">boolean enableHandler ( boolean enable) </pre>
+ <pre class="signature prettyprint">boolean enableHandler(boolean enable) </pre>
</div>
<div class="description">
</ul>
</div>
<script>
- (function (document)
+ (function(document)
{
var inputElement = document.getElementById("search-bar"),
contentElement = document.getElementById("search-bar-content"),
</ul>
</div>
<script>
- (function (document)
+ (function(document)
{
var inputElement = document.getElementById("search-bar"),
contentElement = document.getElementById("search-bar-content"),
</ul>
</div>
<script>
- (function (document)
+ (function(document)
{
var inputElement = document.getElementById("search-bar"),
contentElement = document.getElementById("search-bar-content"),
<tr>
<td>
- <pre class="intable prettyprint">SearchBar <a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint">SearchBar <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the search bar.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">SearchBar <a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint">SearchBar <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the search bar.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">string <a href="#method-value">value</a> ( string? value ) </pre>
+ <pre class="intable prettyprint">string <a href="#method-value">value</a>(string? value) </pre>
</td>
<td><p>Gets or sets an input text value.</p></td>
</tr>
<p>Disables the search bar.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">SearchBar disable ( ) </pre>
+ <pre class="signature prettyprint">SearchBar disable() </pre>
</div>
<div class="description">
<p>Enables the search bar.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">SearchBar enable ( ) </pre>
+ <pre class="signature prettyprint">SearchBar enable() </pre>
</div>
<div class="description">
<p>Gets or sets an input text value.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">string value ( string? value) </pre>
+ <pre class="signature prettyprint">string value(string? value) </pre>
</div>
<p><span class="version">Since: </span>
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-// Value contains the input text
+/* Value contains the input text */
$("#searchbar").searchbar("value");
-// "New text" is the new input value
+/* "New text" is the new input value */
$("#searchbar").searchbar("value", "New text");
</pre>
</div>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-open">open</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Opens the select menu.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-close">close</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Closes the select menu.</p></td>
</tr>
<p>Opens the select menu.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">open ( ) </pre>
+ <pre class="signature prettyprint">open() </pre>
</div>
<div class="description">
<p>Closes the select menu.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">close ( ) </pre>
+ <pre class="signature prettyprint">close() </pre>
</div>
<div class="description">
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-open">open</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Runs opening animations.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">boolean <a href="#method-opened">opened</a> ( ) </pre>
+ <pre class="intable prettyprint">boolean <a href="#method-opened">opened</a>() </pre>
</td>
<td><p>Checks whether a swipe element is opened.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-close">close</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Runs closing animations.</p></td>
</tr>
<p>Runs opening animations.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">open ( ) </pre>
+ <pre class="signature prettyprint">open() </pre>
</div>
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<div id="swipe" data-role="swipe">
+<div id="swipe" data-role="swipe">
<div data-role="swipe-item-cover">
Swipe
</div>
<p>Checks whether a swipe element is opened.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">boolean opened ( ) </pre>
+ <pre class="signature prettyprint">boolean opened() </pre>
</div>
<div class="returntype">
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<div id="swipe" data-role="swipe">
+<div id="swipe" data-role="swipe">
<div data-role="swipe-item-cover">
Swipe
</div>
<p>Runs closing animations.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">close ( ) </pre>
+ <pre class="signature prettyprint">close() </pre>
</div>
<div class="returntype">
</div>
<script>
var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
- swipeWidget.open();
+ swipeWidget.open();
<script>
</pre></li>
</div>
</div>
<script>
- (function (document)
+ (function(document)
{
var pageElement = document.getElementById("tab-bar-page"),
tabBarElement = document.getElementById("ready-for-tab-bar"),
</div>
</div>
<script>
- (function (document)
+ (function(document)
{
function createPageHandle()
{
var elementToken = document.getElementById("ns-tokentextarea"),
tokentextarea = tau.widget.TokenTextarea(elementToken);
- // Get the label
+ /* Get the label */
tokentextarea.option("label");
- // Set the label
+ /* Set the label */
tokentextarea.option("label", "e-mail To:");
- // Get the link
+ /* Get the link */
tokentextarea.option("link");
- // Set the link
+ /* Set the link */
tokentextarea.option("link", "favorites.html");
- // Get the message format
+ /* Get the message format */
tokentextarea.option("description");
- // Set the message format
+ /* Set the message format */
tokentextarea.option("description", "bar + {0}");
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-add">add</a> ( string messages, number blockIndex ) </pre>
+ <pre class="intable prettyprint"><a href="#method-add">add</a>(string messages, number blockIndex) </pre>
</td>
<td><p>Adds a new token text area component button with specified text in the place of the index.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Tokentextarea <a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint">Tokentextarea <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the token text area.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Tokentextarea <a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint">Tokentextarea <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the token text area.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-focusIn">focusIn</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-focusIn">focusIn</a>() </pre>
</td>
<td><p>Ungroups the elements and sets a focus to the input.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-focusOut">focusOut</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-focusOut">focusOut</a>() </pre>
</td>
<td><p>Groups elements and hides the input.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">string <a href="#method-inputText">inputText</a> ( string text ) </pre>
+ <pre class="intable prettyprint">string <a href="#method-inputText">inputText</a>(string text) </pre>
</td>
<td><p>Manages the component input box text.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">number <a href="#method-length">length</a> ( ) </pre>
+ <pre class="intable prettyprint">number <a href="#method-length">length</a>() </pre>
</td>
<td><p>Returns the block count.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-remove">remove</a> ( number blockIndex ) </pre>
+ <pre class="intable prettyprint"><a href="#method-remove">remove</a>(number blockIndex) </pre>
</td>
<td><p>Deletes a token text area component button at the specified index position. If no parameter is defined, all token text area component buttons are deleted.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">?string <a href="#method-select">select</a> ( number blockIndex ) </pre>
+ <pre class="intable prettyprint">?string <a href="#method-select">select</a>(number blockIndex) </pre>
</td>
<td><p>Selects the token text area button based on its index value.<br />If a parameter is set, the token text area button matching the index value is selected.<br />If a token text area button is selected and the parameter is not set, the method returns the string of the selected button. If no button is selected, the method returns <code>null</code>.</p></td>
</tr>
<p>Adds a new token text area component button with specified text in the place of the index.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">add ( string messages, number blockIndex) </pre>
+ <pre class="signature prettyprint">add(string messages, number blockIndex) </pre>
</div>
<div class="description">
<p>Disables the token text area.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Tokentextarea disable ( ) </pre>
+ <pre class="signature prettyprint">Tokentextarea disable() </pre>
</div>
<div class="description">
<p>Enables the token text area.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Tokentextarea enable ( ) </pre>
+ <pre class="signature prettyprint">Tokentextarea enable() </pre>
</div>
<div class="description">
<p>Ungroups the elements and sets a focus to the input.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">focusIn ( ) </pre>
+ <pre class="signature prettyprint">focusIn() </pre>
</div>
<div class="description">
<p>Groups elements and hides the input.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">focusOut ( ) </pre>
+ <pre class="signature prettyprint">focusOut() </pre>
</div>
<div class="description">
<p>Manages the component input box text.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">string inputText ( string text) </pre>
+ <pre class="signature prettyprint">string inputText(string text) </pre>
</div>
<div class="description">
<script>
var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- // Set the text in the input box
+ /* Set the text in the input box */
tokenWidget.inputText("foobar");
- // Get the input box text
+ /* Get the input box text */
tokenWidget.inputText();
</script>
</pre>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- // Set the text in the input box
+ /* Set the text in the input box */
$("#ns-tokentext").tokentextarea("inputText", "foobar");
- // Get the input box text
+ /* Get the input box text */
$("#ns-tokentext").tokentextarea("inputText");
</script>
</pre>
<p>Returns the block count.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">number length ( ) </pre>
+ <pre class="signature prettyprint">number length() </pre>
</div>
<div class="description">
<p>Deletes a token text area component button at the specified index position. If no parameter is defined, all token text area component buttons are deleted.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">remove ( number blockIndex) </pre>
+ <pre class="signature prettyprint">remove(number blockIndex) </pre>
</div>
<p>Selects the token text area button based on its index value.<br />If a parameter is set, the token text area button matching the index value is selected.<br />If a token text area button is selected and the parameter is not set, the method returns the string of the selected button. If no button is selected, the method returns null.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">?string select ( number blockIndex) </pre>
+ <pre class="signature prettyprint">?string select(number blockIndex) </pre>
</div>
<div class="description">
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- // Select first block
+ /* Select first block */
var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
tokenWidget.add("text 1");
tokenWidget.add("text 2");
tokenWidget.select(0);
- // Get string from selected block
+ /* Get string from selected block */
tokenWidget.select();
</script>
</pre>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- // Select first block
+ /* Select first block */
$("#ns-tokentext").tokentextarea("add", "text 1");
$("#ns-tokentext").tokentextarea("add", "text 2");
$("#ns-tokentext").tokentextarea("select", "0");
- // Get string from selected block
+ /* Get string from selected block */
$("#ns-tokentext").tokentextarea("select");
</script>
</pre>
var buttonElement = document.getElementById("button"),
button = tau.widget.Button(buttonElement);
- // button.methodName(methodArgument1, methodArgument2, ...);
- // For example:
+ /*
+ button.methodName(methodArgument1, methodArgument2, ...);
+ For example:
+ */
button.value("text");
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint">Button <a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint">Button <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the button.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Button <a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint">Button <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the button.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Button <a href="#method-refresh">refresh</a> ( ) </pre>
+ <pre class="intable prettyprint">Button <a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes a button markup.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">string <a href="#method-value">value</a> ( string? value ) </pre>
+ <pre class="intable prettyprint">string <a href="#method-value">value</a>(string? value) </pre>
</td>
<td><p>Gets or sets a value.</p></td>
</tr>
<p>Disables the button.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Button disable ( ) </pre>
+ <pre class="signature prettyprint">Button disable() </pre>
</div>
<div class="description">
<p>Enables the button.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Button enable ( ) </pre>
+ <pre class="signature prettyprint">Button enable() </pre>
</div>
<div class="description">
<p>Refreshes a button markup.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Button refresh ( ) </pre>
+ <pre class="signature prettyprint">Button refresh() </pre>
</div>
<div class="description">
<p>Gets or sets a value.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">string value ( string? value) </pre>
+ <pre class="signature prettyprint">string value(string? value) </pre>
</div>
<p><span class="version">Since: </span>
<script>
var element = document.getElementById("button"),
buttonWidget = tau.widget.Button(element),
- // Value contains inner text of button
- value = buttonWidget.value();
+ /* Value contains inner text of button */
+ value = buttonWidget.value();
- // "New text" will be text of button
+ /* "New text" will be text of button */
buttonWidget.value("New text");
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-value">value</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-value">value</a>() </pre>
</td>
<td><p>Set/Return a value from checkbox element.</p></td>
</tr>
<p>Disables the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">disable ( ) </pre>
+ <pre class="signature prettyprint">disable() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="checkbox" name="checkbox-1" id="checkbox-1"/><label for="checkbox-1">Normal</label>
+<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
+<label for="checkbox-1">Normal</label>
<script>
var element = document.getElementById("checkbox-1"),
checkboxWidget = tau.widget.Checkbox(element);
<p>Enables the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">enable ( ) </pre>
+ <pre class="signature prettyprint">enable() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="checkbox" name="checkbox-1" id="checkbox-1"/><label for="checkbox-1">Normal</label>
+<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
+<label for="checkbox-1">Normal</label>
<script>
var element = document.getElementById("checkbox-1"),
checkboxWidget = tau.widget.Checkbox(element);
<p>Set/Return a value from checkbox element.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">{ string | number } value ( ) </pre>
+ <pre class="signature prettyprint">{string | number} value() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="checkbox" name="checkbox-1" id="checkbox-1"/><label for="checkbox-1">Normal</label>
+<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
+<label for="checkbox-1">Normal</label>
<script>
var element = document.getElementById("checkbox-1"),
checkboxWidget = tau.widget.Checkbox(element);
- // Set value to checkbox element
+ /* Set value to checkbox element */
checkboxWidget.value("checkbox-value");
- // Returns checked checkbox element
+ /* Return checked checkbox element */
console.log(checkboxWidget.value());
</script>
</pre>
</ul>
<script>
var elColoredList = document.getElementById("coloredlist"),
- coloredList = tau.widget.ColoredListview(elColoredList);
+ coloredList = tau.widget.ColoredListview(elColoredList);
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-close">close</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Closes the drawer.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-isOpen">isOpen</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-isOpen">isOpen</a>() </pre>
</td>
<td><p>Checks the drawer status.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-open">open</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Opens the drawer.</p></td>
</tr>
<p>Closes the drawer.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">close ( ) </pre>
+ <pre class="signature prettyprint">close() </pre>
</div>
<div class="description">
<p>Checks the drawer status.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">isOpen ( ) </pre>
+ <pre class="signature prettyprint">isOpen() </pre>
</div>
<div class="description">
<p>Opens the drawer.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">open ( ) </pre>
+ <pre class="signature prettyprint">open() </pre>
</div>
<div class="description">
<p>For manual creation of DropdownMenu component you can use constructor of component.</p>
-<pre class="prettyprint"> <select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
- </select>
- <script>
- var element = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(element);
- </script>
+<pre class="prettyprint">
+<select id="dropdownmenu" data-native-menu="false">
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
+</select>
+<script>
+ var element = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(element);
+</script>
</pre>
<h2><a id='html-examples0.1808658204972744'></a>HTML Examples</h2>
<h3><a id='create-dropdownmenu0.4046689202077687'></a>Basic</h3>
-<pre class="prettyprint"><select data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+<pre class="prettyprint">
+<select data-native-menu="false">
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre>
<p>When data-inline attribute is set to true, width of the DropdownMenu is determined by its text.</p>
-<pre class="prettyprint"><select id="dropdownmenu" data-native-menu="false" data-inline="true">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+<pre class="prettyprint">
+<select id="dropdownmenu" data-native-menu="false" data-inline="true">
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre>
<h3><a id='placeholder-options0.16344462637789547'></a>With Placeholder</h3>
<p>If you use <code><option></code> with data-placeholder="true" attribute, you can make a default placeholder. </p>
-<pre class="prettyprint"><select id="dropdownmenu" data-native-menu="false" data-hide-placeholder-menu-items="false">
- <option value="choose-one" data-placeholder="true">Choose an option</option>
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+<pre class="prettyprint">
+<select id="dropdownmenu" data-native-menu="false" data-hide-placeholder-menu-items="false">
+ <option value="choose-one" data-placeholder="true">Choose an option</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre>
<tbody>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-open">open</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Open DropdownMenu</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-close">close</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Close DropdownMenu</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-_enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-_enable">enable</a>() </pre>
</td>
<td><p>Enable DropdownMenu</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-_disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-_disable">disable</a>() </pre>
</td>
<td><p>Disable DropdownMenu</p></td>
</tr>
<p>Open DropdownMenu</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">open ( ) </pre>
+ <pre class="signature prettyprint">open() </pre>
</div>
<div class="description">
<pre name="code" class="examplecode
prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
-var elDropdownMenu = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(elDropdownMenu);
+ var elDropdownMenu = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(elDropdownMenu);
-widget.open();
+ widget.open();
</script>
</pre>
</div>
<p>Close DropdownMenu</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">close ( ) </pre>
+ <pre class="signature prettyprint">close() </pre>
</div>
<div class="description">
<pre name="code" class="examplecode
prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
-var elDropdownMenu = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(elDropdownMenu);
+ var elDropdownMenu = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(elDropdownMenu);
-widget.close();
+ widget.close();
</script>
</pre>
</div>
<p>Enable DropdownMenu</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">enable ( ) </pre>
+ <pre class="signature prettyprint">enable() </pre>
</div>
<div class="description">
<pre name="code" class="examplecode
prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
-var elDropdownMenu = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(elDropdownMenu);
+ var elDropdownMenu = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(elDropdownMenu);
-widget.enable();
+ widget.enable();
</script>
</pre>
</div>
<p>Disable DropdownMenu</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">disable ( ) </pre>
+ <pre class="signature prettyprint">disable() </pre>
</div>
<div class="description">
<pre name="code" class="examplecode
prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
-var elDropdownMenu = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(elDropdownMenu);
+ var elDropdownMenu = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(elDropdownMenu);
-widget.disable();
+ widget.disable();
</script>
</pre>
</div>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the expandable component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the expandable component.</p></td>
</tr>
<p>Disables the expandable component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">disable ( ) </pre>
+ <pre class="signature prettyprint">disable() </pre>
</div>
<div class="description">
<p>Enables the expandable component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">enable ( ) </pre>
+ <pre class="signature prettyprint">enable() </pre>
</div>
<div class="description">
<pre class="prettyprint">
<ul id="gridview" class="ui-gridview">
<li class="ui-gridview-item">
- <img class="ui-gridview-image" src="images/1.jpg">
+ <img class="ui-gridview-image" src="images/1.jpg"/>
<div class="ui-gridview-handler"></div>
</li>
<li class="ui-gridview-item">
- <img class="ui-gridview-image" src="images/2.jpg">
+ <img class="ui-gridview-image" src="images/2.jpg"/>
<div class="ui-gridview-handler"></div>
</li>
<li class="ui-gridview-item">
- <img class="ui-gridview-image" src="images/3.jpg">
+ <img class="ui-gridview-image" src="images/3.jpg"/>
<div class="ui-gridview-handler"></div>
</li>
<li class="ui-gridview-item">
- <img class="ui-gridview-image" src="images/4.jpg">
+ <img class="ui-gridview-image" src="images/4.jpg"/>
<div class="ui-gridview-handler"></div>
</li>
</ul>
<tbody>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-add">addItem</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-add">addItem</a>() </pre>
</td>
<td><p>Add an item to grid view</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-remove">removeItem</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-remove">removeItem</a>() </pre>
</td>
<td><p>Remove an item from grid view</p></td>
</tr>
<p>Add an item to grid view</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">addItem (HTMLElement item) </pre>
+ <pre class="signature prettyprint">addItem(HTMLElement item) </pre>
</div>
<div class="parameters">
<pre name="code" class="examplecode
prettyprint">
<script>
-var elGridView = document.getElementById("gridview"),
- gridView = tau.widget.GridView(elGridView),
- item;
+ var elGridView = document.getElementById("gridview"),
+ gridView = tau.widget.GridView(elGridView),
+ item;
-gridView.addItem(item);
+ gridView.addItem(item);
</script>
</pre>
</div>
<p>Remove an item from grid view</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">removeItem (HTMLElement item) </pre>
+ <pre class="signature prettyprint">removeItem(HTMLElement item) </pre>
</div>
<div class="parameters">
<pre name="code" class="examplecode
prettyprint">
<script>
-var elGridView = document.getElementById("gridview"),
- gridView = tau.widget.GridView(elGridView),
- item;
+ var elGridView = document.getElementById("gridview"),
+ gridView = tau.widget.GridView(elGridView),
+ item;
-gridView.removeItem(item);
+ gridView.removeItem(item);
</script>
</pre>
</div>
<script src="./panel.js"></script>
</div>
-<!-- in panel.html -->
+<!--panel.html-->
<div id="panel2" class="ui-panel">
<div class="ui-content">
<ul class="ui-listview">
</div>
</pre>
<h4>JS example with PanelChanger</h4>
-<pre class="prettyprint"><!-- in panel.js -->
-(function() {
+<pre class="prettyprint">
+/* panel.js */
+(function()
+{
var page = document.querySelector("#panelPage"),
- panelChanger = page.querySelector("#panelChanger"),
- panelChangerComponent,
- navigation = page.querySelector("#navigation"),
- navigationComponent,
- navigated = false;
-
- page.addEventListener("pagebeforeshow", function(){
+ panelChanger = page.querySelector("#panelChanger"),
+ panelChangerComponent,
+ navigation = page.querySelector("#navigation"),
+ navigationComponent,
+ navigated = false;
+
+ page.addEventListener("pagebeforeshow", function()
+ {
var activePanel = page.querySelector(".ui-panel-active");
panelChangerComponent = tau.widget.PanelChanger(panelChanger);
navigationComponent = tau.widget.Navigation(navigation);
navigationComponent.push(activePanel.id);
});
- panelChanger.addEventListener("panelchange", function(event) {
+ panelChanger.addEventListener("panelchange", function(event)
+ {
var toPanel = event.detail.toPanel,
- direction = event.detail.direction,
- id = toPanel.id;
+ direction = event.detail.direction,
+ id = toPanel.id;
- if (id) {
- if (direction === "forward") {
+ if (id)
+ {
+ if (direction === "forward")
+ {
navigationComponent.push(id);
- } else {
- if (navigated === false) {
+ }
+ else
+ {
+ if (navigated === false)
+ {
navigationComponent.pop();
- } else {
+ }
+ else
+ {
navigated = false;
}
}
- } else {
+ }
+ else
+ {
console.warn("You should insert id value in the each panels")
}
});
- navigation.addEventListener("navigate", function(event) {
+ navigation.addEventListener("navigate", function(event)
+ {
var id = event.detail.id;
navigated = true;
panelChangerComponent.changePanel("#" + id, "slide-reverse", "back");
});
})();
- </pre>
+</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-create">create</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-create">create</a>() </pre>
</td>
<td><p>Initiates the making of the navigation.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-push">push</a> ( String targetId ) </pre>
+ <pre class="intable prettyprint"><a href="#method-push">push</a>(String targetId) </pre>
</td>
<td><p>Add navigation item only one at a time.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-pop">pop</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-pop">pop</a>() </pre>
</td>
<td><p>Pop last child of navigation.</p></td>
</tr>
<p>Initiates the making of the navigation.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">create ( ) </pre>
+ <pre class="signature prettyprint">create() </pre>
</div>
<div class="description">
<p>Add navigation item only one at a time.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">push ( String targetId ) </pre>
+ <pre class="signature prettyprint">push(String targetId) </pre>
</div>
<div class="parameters">
</div>
<script>
var navigation = page.querySelector("#navigation"),
- activePanel = page.querySelector(".ui-panel-active"),
- navigationComponent = tau.widget.Navigation(navigation);
- navigationComponent.push(activePanel.id);
+ activePanel = page.querySelector(".ui-panel-active"),
+ navigationComponent = tau.widget.Navigation(navigation);
+ navigationComponent.push(activePanel.id);
</script></pre>
</div>
<p>Pop last child of navigation.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">pop ( ) </pre>
+ <pre class="signature prettyprint">pop() </pre>
</div>
</div>
<script>
var navigation = page.querySelector("#navigation"),
- navigationComponent = tau.widget.Navigation(navigation);
+ navigationComponent = tau.widget.Navigation(navigation);
navigationComponent.pop();
</script>
<div class="ui-content">
<div class="ui-page-indicator" id="pageIndicator" data-number-of-pages="4" style="bottom: 0;"></div>
<div id="hsectionchanger" class="ui-section-changer">
- <!-- section changer has only one child. -->
+ <!--Section changer has only one child-->
<div>
<section class="ui-section-active">
<ul class="ui-listview">
</div>
<script>
var sectionChanger = document.getElementById("hsectionchanger"),
- elPageIndicator = document.getElementById("pageIndicator"),
- pageIndicator;
+ elPageIndicator = document.getElementById("pageIndicator"),
+ pageIndicator;
pageIndicator = tau.widget.PageIndicator(elPageIndicator);
- sectionChanger.addEventListener("sectionchange", function(e) { pageIndicator.setActive(e.detail.active); }, false);
+ sectionChanger.addEventListener("sectionchange", function(e)
+ {
+ pageIndicator.setActive(e.detail.active);
+ }, false);
</script>
</pre>
</li></ul>
</table>
<br>
<p>
-Take an example : the situation that the value of data-number-of-pages is "5"(5 pages in all), and the value of data-max-page is "3"(3 dots).<br>
+Take an example : the situation that the value of data-number-of-pages is "5" (5 pages in all), and the value of data-max-page is "3" (3 dots).<br>
<pre class="prettyprint">
<div id="pageIndicator" class="ui-page-indicator" data-number-of-pages="5" data-max-page="3"></div>
</pre>
<br>
-When you scroll the page(or section) horizontally, the number of exceeding pages( in this case, it is 2 pages, which is the result of 5 - 3 )<br>
+When you scroll the page (or section) horizontally, the number of exceeding pages (in this case, it is 2 pages, which is the result of 5 - 3)<br>
would be indicated by the central dot, from middle of the pages.<br>
<br>
-So, the first dot is for the first page, and the last dot is for the fifth( the last) page.<br>
+So, the first dot is for the first page, and the last dot is for the fifth (the last) page.<br>
And the middle dot is shared by 2nd, 3rd and 4th page while scrolling pages.<br>
<br>
-In the case of even value of data-max-page( the number of dots on the screen), the next order of half of the data-max-page value would work as middle dot.<br>
-For example, in the situation that the value of data-number-of-pages is "6", and the value of data-max-page is "4", the 3rd dot( the result of 4 / 2 + 1) would indicate
+In the case of even value of data-max-page (the number of dots on the screen), the next order of half of the data-max-page value would work as middle dot.<br>
+For example, in the situation that the value of data-number-of-pages is "6", and the value of data-max-page is "4", the 3rd dot (the result of 4 / 2 + 1) would indicate
3rd, 4th and 5th pages as middle dot.<br>
<br>
Of course, the value of data-number-of-pages should meet the number of the pages you have added to HTML.<br>
<br>
-And if the the value of data-max-page(dots) exceeds the value of data-number-of-pages, indicator dots will be displayed as the value of data-number-of-pages.<br>
+And if the the value of data-max-page (dots) exceeds the value of data-number-of-pages, indicator dots will be displayed as the value of data-number-of-pages.<br>
For example, in the situation that the value of numberOfPages is "6", and the value of maxPage is "100",there would be still 6 dots on the screen.
</P>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-setActive">setActive</a> ( number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-setActive">setActive</a>(number index) </pre>
</td>
<td><p>This method sets a dot to active state.</p></td>
</tr>
<p>This method sets a dot to active state.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">setActive ( number index) </pre>
+ <pre class="signature prettyprint">setActive(number index) </pre>
</div>
<div class="description">
<pre class="prettyprint">
var elPanelChanger = document.getElementById("panelchanger"),
- panelChanger = tau.widget.PanelChanger(elPanelChanger);
+ panelChanger = tau.widget.PanelChanger(elPanelChanger);
</pre>
<h2><a id="html-examples"></a>HTML Examples</h2>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-changePanel">changePanel</a> ( String address, String animationType, String direction ) </pre>
+ <pre class="intable prettyprint"><a href="#method-changePanel">changePanel</a>(String address, String animationType, String direction) </pre>
</td>
<td><p>Change panel method</p></td>
</tr>
<p>change panel</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">changePanel ( String address, String animationType, String direction) </pre>
+ <pre class="signature prettyprint">changePanel(String address, String animationType, String direction) </pre>
</div>
<div class="description">
<div id="1btn_popup" class="ui-popup">
<div class="ui-popup-header">Popup Header</div>
<div class="ui-popup-content popup-content-padding">
- Lorem ipsum dolor sit amet,
- consectetur adiptiscing elit, sed
- doei usmod tempore sit ipsum
+ Lorem ipsum dolor sit amet,
+ consectetur adiptiscing elit, sed
+ doei usmod tempore sit ipsum
</div>
<div class="ui-popup-footer">
<a class="ui-btn" data-rel="back" data-inline="true">Cancel</a>
<p>This is a completely basic popup, no options set.</p>
</div>
<script>
- // Use popup events
+ /* Use popup events */
var popup = document.getElementById("popup");
popup.addEventListener("popupafteropen", function()
{
- // Implement code for popupafteropen event
+ /* Implement code for popupafteropen event */
});
</script>
</pre>
<script>
var popupElement = document.getElementById("popup"),
popup = tau.widget.Popup(popupElement);
- // Close popup after opening
- popupElement.addEventListener("popupafteropen", function ()
+ /* Close popup after opening */
+ popupElement.addEventListener("popupafteropen", function()
{
popup.close();
});
var element = document.getElementById("progress"),
progress = tau.widget.Progress(element);
- // progress.methodName(argument1, argument2, ...);
- // For example
+ /*
+ progress.methodName(argument1, argument2, ...);
+ For example:
+ */
progress.refresh();
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-value">value</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-value">value</a>() </pre>
</td>
<td><p>Sets or gets value of Progress component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-option">option</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-option">option</a>() </pre>
</td>
<td><p>Sets or gets options of Progress component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-refresh">refresh</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes the Progress DOM.</p></td>
</tr>
<p>Sets or gets value of Progress component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">value ( Number value ) </pre>
+ <pre class="signature prettyprint">value(Number value) </pre>
</div>
<div class="description">
<br>
progress = tau.widget.Progress(element),
originValue;
- // Get the origin value of progress
+ /* Get the origin value of progress */
originValue = progress.value();
console.log(originValue);
- // sets the value of progress to 70
+ /* Set the value of progress to 70 */
progress.value(70);
</script>
</pre>
<p>Sets or gets options of Progress component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">option ( ) </pre>
+ <pre class="signature prettyprint">option() </pre>
</div>
<div class="description">
<p>
type;
progress.option("value", 50);
- // After change option, please call refresh method.
+ /* After change option, call refresh method */
progress.refresh();
- // Gets type option value
+ /* Get type option value */
type = progress.option("type");
console.log(type);
</script>
<p>Refresh Progress DOM.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">refresh ( ) </pre>
+ <pre class="signature prettyprint">refresh() </pre>
</div>
<div class="description">
<p>
var element = document.getElementById("progress"),
progress = tau.widget.Progress(element);
- // Change DOM dynamically or change option
+ /* Change DOM dynamically or change option */
progress.refresh();
</script>
</pre>
<p>To create a radio component, please refer following example:</p>
-<pre class="prettyprint"><input type="radio" name="radio-choice" id="radio-choice-1" value="choice-1" checked="checked" />
+<pre class="prettyprint"><input type="radio" name="radio-choice" id="radio-choice-1" value="choice-1" checked="checked"/>
<label for="radio-choice-1">Cat</label>
-<input type="radio" name="radio-choice" id="radio-choice-2" value="choice-2" />
+<input type="radio" name="radio-choice" id="radio-choice-2" value="choice-2"/>
<label for="radio-choice-2">Dog</label>
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the component.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-value">value</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-value">value</a>() </pre>
</td>
<td><p>Set/Return a value from radio element.</p></td>
</tr>
<p>Disables the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">disable ( ) </pre>
+ <pre class="signature prettyprint">disable() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="radio" name="radio-1" id="radio-1"/><label for="radio-1">Normal</label>
+<input type="radio" name="radio-1" id="radio-1"/>
+<label for="radio-1">Normal</label>
<script>
var element = document.getElementById("radio-1"),
radioWidget = tau.widget.Radio(element);
<p>Enables the component.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">enable ( ) </pre>
+ <pre class="signature prettyprint">enable() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="radio" name="radio-1" id="radio-1"/><label for="radio-1">Normal</label>
+<input type="radio" name="radio-1" id="radio-1"/>
+<label for="radio-1">Normal</label>
<script>
var element = document.getElementById("radio-1"),
radioWidget = tau.widget.Radio(element);
<p>Set/Return a value from radio element.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">{ string | number } value ( ) </pre>
+ <pre class="signature prettyprint">{string | number} value() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input type="radio" name="radio-1" id="radio-1"/><label for="radio-1">Normal</label>
+<input type="radio" name="radio-1" id="radio-1"/>
+<label for="radio-1">Normal</label>
<script>
var element = document.getElementById("radio-1"),
radioWidget = tau.widget.Radio(element);
- // Set value to radio element
+ /* Set value to radio element */
radioWidget.value("radio-value");
- // Returns checked radio element
+ /* Return checked radio element */
console.log(radioWidget.value());
</script>
</pre>
<p>To manually create a SearchInput component, use the component constructor from the <code>tau</code> namespace.</p>
<pre class="prettyprint">
-<input type="search" id="search-test" />
+<input type="search" id="search-test"/>
<script>
var searchEl = document.getElementById("search-test"),
- searchWidget = tau.widget.SearchInput(searchEl);
+ searchWidget = tau.widget.SearchInput(searchEl);
</script>
</pre>
<tbody>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disable the SearchInput.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enable the SearchInput.</p></td>
</tr>
<p>Disable the SearchInput.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">disable ( ) </pre>
+ <pre class="signature prettyprint">disable() </pre>
</div>
<div class="description">
<p>Enable the SearchInput.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">enable ( ) </pre>
+ <pre class="signature prettyprint">enable() </pre>
</div>
<div class="description">
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-setActive">setActiveSection</a> ( number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-setActive">setActiveSection</a>(number index) </pre>
</td>
<td><p>Changes the currently active section element (index).
<br>For smooth scrolling, the <span style="font-family: Courier New,Courier,monospace">duration</span> parameter must be in milliseconds.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-getActiveSectionIndex">getActiveSectionIndex</a> () </pre>
+ <pre class="intable prettyprint"><a href="#method-getActiveSectionIndex">getActiveSectionIndex</a>() </pre>
</td>
<td><p>Gets the currently active section element's index.
<br>The return value is a number (<span style="font-family: Courier New,Courier,monospace">activeIndex</span>).</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-refresh">refresh</a> () </pre>
+ <pre class="intable prettyprint"><a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Updates the section changer form.
<br>When you add new section dynamically through JavaScript, you must call the <span style="font-family: Courier New,Courier,monospace">refresh()</span> method to update section information.</p></td>
<br>For smooth scrolling, the <span style="font-family: Courier New,Courier,monospace">duration</span> parameter must be in milliseconds.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">setActiveSection ( number index) </pre>
+ <pre class="signature prettyprint">setActiveSection(number index) </pre>
</div>
<div class="description">
<br>The return value is a number (<span style="font-family: Courier New,Courier,monospace">activeIndex</span>).</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">getActiveSectionIndex () </pre>
+ <pre class="signature prettyprint">getActiveSectionIndex() </pre>
</div>
<div class="description">
<br>When you add new section dynamically through JavaScript, you must call the <span style="font-family: Courier New,Courier,monospace">refresh()</span> method to update section information.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">refresh () </pre>
+ <pre class="signature prettyprint">refresh() </pre>
</div>
<div class="description">
<p>To manually create a slider component, use the component constructor from the <code>tau</code> namespace</p>
-<pre class="prettyprint"><input id="slider" />
+<pre class="prettyprint"><input id="slider"/>
<script>
var sliderElement = document.getElementById("slider"),
slider = tau.widget.Slider(sliderElement);
<p>To create slider input:</p>
-<pre class="prettyprint"><input type="range" name="slider-1" id="slider" value="60" min="0" max="100" />
+<pre class="prettyprint"><input type="range" name="slider-1" id="slider" value="60" min="0" max="100"/>
</pre>
<h2><a id="options-list"></a>Options</h2>
<p>To call a method on the component, use one of the existing APIs:</p>
-<pre class="prettyprint"><input id="slider" type="range" name="slider" value="60" min="0" max="100" />
+<pre class="prettyprint"><input id="slider" type="range" name="slider" value="60" min="0" max="100"/>
<script>
var slider = document.getElementById("slider"),
slider = tau.widget.Slider(slider);
- // slider.methodName(methodArgument1, methodArgument2, ...);
- // For example
+ /*
+ slider.methodName(methodArgument1, methodArgument2, ...);
+ For example:
+ */
var value = slider.value(5);
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint">Slider <a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint">Slider <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the slider.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Slider <a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint">Slider <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the slider.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">Slider <a href="#method-refresh">refresh</a> ( ) </pre>
+ <pre class="intable prettyprint">Slider <a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes a slider markup.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">string <a href="#method-value">value</a> ( ) </pre>
+ <pre class="intable prettyprint">string <a href="#method-value">value</a>() </pre>
</td>
<td><p>Gets or sets a value.</p></td>
</tr>
<p>Disables the slider.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Slider disable ( ) </pre>
+ <pre class="signature prettyprint">Slider disable() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10" />
+<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10"/>
<script>
var slider = document.getElementById("mySlider1"),
sliderWidget = tau.widget.Slider(slider);
<p>Enables the slider.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Slider enable ( ) </pre>
+ <pre class="signature prettyprint">Slider enable() </pre>
</div>
<div class="description">
example :</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10" />
+<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10"/>
<script>
var slider = document.getElementById("mySlider1"),
sliderWidget = tau.widget.Slider(slider);
<p>Refreshes a slider markup.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Slider refresh ( ) </pre>
+ <pre class="signature prettyprint">Slider refresh() </pre>
</div>
<div class="description">
example :</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10" />
+<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10"/>
<script>
var slider = document.getElementById("mySlider1"),
sliderWidget = tau.widget.Slider(slider);
<p>Gets or sets a value.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">string value ( ) </pre>
+ <pre class="signature prettyprint">string value() </pre>
</div>
<p><span class="version">Since: </span>
example :</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10" />
+<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10"/>
<script>
var slider = document.getElementById("mySlider1"),
sliderWidget = tau.widget.Slider(slider);
- // Value contains index of select tag
+ /* Value contains index of select tag */
value = sliderWidget.value();
- // Sets the index for the slider
+ /* Sets the index for the slider */
sliderWidget.value("1");
</script>
</pre>
<p>For manual creation of tabs widget you can use constructor of widget</p>
-<pre class="prettyprint"> <script>
- var tabsElement = document.getElementById("tabs"),
- tabs;
- tabs = tau.widget.Tabs(tabsElement);
- </script>
+<pre class="prettyprint">
+<script>
+ var tabsElement = document.getElementById("tabs"),
+ tabs;
+ tabs = tau.widget.Tabs(tabsElement);
+</script>
</pre>
<h2><a id="methods-list"></a>Methods list</h2>
<tbody>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-setIndex">setIndex</a> ( number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-setIndex">setIndex</a>(number index) </pre>
</td>
<td><p>Set the active tab index</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">number <a href="#method-getIndex">getIndex</a> ( ) </pre>
+ <pre class="intable prettyprint">number <a href="#method-getIndex">getIndex</a>() </pre>
</td>
<td><p>Get the active tab index</p></td>
</tr>
<p>Set the active tab index</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">setIndex ( number index) </pre>
+ <pre class="signature prettyprint">setIndex(number index) </pre>
</div>
<div class="description">
<p>
<p>Get the active tab index</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">number getIndex ( ) </pre>
+ <pre class="signature prettyprint">number getIndex() </pre>
</div>
<div class="description">
<p>
<p>To manually create a TextEnveloper component, use the component constructor from the tau namespace.</p>
-<pre class="prettyprint"><script>
-var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
+<pre class="prettyprint">
+<script>
+ var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
</script>
</pre>
<p>To call method on component, please refer the following code:</p>
-<pre class="prettyprint">var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
+<pre class="prettyprint">
+var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
textEnveloper.methodName(methodArgument1, methodArgument2, ...);
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-add">add</a> ( string messages ) </pre>
+ <pre class="intable prettyprint"><a href="#method-add">add</a>(string messages) </pre>
</td>
<td><p>Add message token to textenveloper.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-remove">remove</a> ( number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-remove">remove</a>(number index) </pre>
</td>
<td><p>Delete token matched index.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">number <a href="#method-length">length</a> ( ) </pre>
+ <pre class="intable prettyprint">number <a href="#method-length">length</a>() </pre>
</td>
<td><p>Return count number of tokens.</p></td>
</tr>
<p>Add message token to textenveloper.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">add ( string messages ) </pre>
+ <pre class="signature prettyprint">add(string messages) </pre>
</div>
<div class="description">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
- prettyprint"><script>
-var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
+ prettyprint">
+<script>
+ var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
-textEnveloper.add("hello");
+ textEnveloper.add("hello");
</script>
</pre>
</div>
<p>Delete token matched index.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">remove ( number index ) </pre>
+ <pre class="signature prettyprint">remove(number index) </pre>
</div>
<div class="description">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
- prettyprint"><script>
-var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
+ prettyprint">
+<script>
+ var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
-textEnveloper.remove(1);
+ textEnveloper.remove(1);
</script>
</pre>
</div>
<p>Return count number of tokens.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">number length ( ) </pre>
+ <pre class="signature prettyprint">number length() </pre>
</div>
<div class="description">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
- prettyprint"><script>
-var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement),
- textTokenLength;
-
-textEnveloper.add("hello1");
-textEnveloper.add("hello2");
-//textTokenLength will be 2
-textTokenLength = textEnveloper.length();
+ prettyprint">
+<script>
+ var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement),
+ textTokenLength;
+
+ textEnveloper.add("hello1");
+ textEnveloper.add("hello2");
+ /* textTokenLength will be 2 */
+ textTokenLength = textEnveloper.length();
</script>
</pre>
</div>
<tr>
<td>
- <pre class="intable prettyprint">TextInput <a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint">TextInput <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the TextInput</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">TextInput <a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint">TextInput <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the TextInput</p></td>
</tr>
<p>Enables the TextInput</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">TextInput enable ( ) </pre>
+ <pre class="signature prettyprint">TextInput enable() </pre>
</div>
<div class="description">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
- prettyprint"><input type="text" name="texttype" id="texttype" />
+ prettyprint"><input type="text" name="texttype" id="texttype"/>
<script>
var inputElement = document.getElementById("texttype"),
- textInputWidget = tau.widget.TextInput();
+ textInputWidget = tau.widget.TextInput();
textInputWidget.enable();
</script>
<p>Disables the TextInput</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">TextInput disable ( ) </pre>
+ <pre class="signature prettyprint">TextInput disable() </pre>
</div>
<div class="description">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
- prettyprint"><input type="text" name="texttype" id="texttype" />
+ prettyprint"><input type="text" name="texttype" id="texttype"/>
<script>
var inputElement = document.getElementById("texttype"),
- textInputWidget = tau.widget.TextInput();
+ textInputWidget = tau.widget.TextInput();
textInputWidget.disable();
</script>
<pre class="prettyprint">
<input type="checkbox" name="toggle-1" id="toggle-1" class="ui-toggleswitch"/>
-<!-- disabled toggle switch -->
-<input type="checkbox" name="toggle-2" id="toggle-2" class="ui-toggleswitch" disabled/>
+<!--Disabled toggle switch-->
+<input type="checkbox" name="toggle-2" id="toggle-2" class="ui-toggleswitch" disabled />
</pre>
<h4>ToggleSwitch with select tag</h4>
<pre class="prettyprint">
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-disable">disable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the toggle switch.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-enable">enable</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the toggle switch.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-value">value</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-value">value</a>() </pre>
</td>
<td><p>Gets toggleswitch state value.</p></td>
</tr>
<p>Disables the toggle switch.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">ToggleSwitch disable ( ) </pre>
+ <pre class="signature prettyprint">ToggleSwitch disable() </pre>
</div>
<div class="description">
</select>
<script>
var toggle = document.getElementById("flip-11"),
- toggleWidget = tau.widget.ToggleSwitch(toggle),
+ toggleWidget = tau.widget.ToggleSwitch(toggle);
toggleWidget.disable();
</script>
</pre>
<p>Enables the toggle switch.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">ToggleSwitch enable ( ) </pre>
+ <pre class="signature prettyprint">ToggleSwitch enable() </pre>
</div>
<div class="description">
</select>
<script>
var toggle = document.getElementById("flip-11"),
- toggleWidget = tau.widget.ToggleSwitch(toggle),
+ toggleWidget = tau.widget.ToggleSwitch(toggle);
toggleWidget.enable();
</script>
</pre>
<p>Gets a value of toggle switch.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">Number value ( ) </pre>
+ <pre class="signature prettyprint">Number value() </pre>
</div>
<p><span class="version">Since: </span>
<pre class="prettyprint">
<button type="button" class="ui-btn">Button</button>
<a href="#" class="ui-btn">Button</a>
-<input type="button" class="ui-btn" value="Button" />
+<input type="button" class="ui-btn" value="Button"/>
<!--Inline button-->
-<input type="button" class="ui-btn ui-inline" value="Button" />
+<input type="button" class="ui-btn ui-inline" value="Button"/>
<!--Multi-line text button-->
<a href="#" class="ui-btn ui-multiline ui-inline">A Button<br/>Icon</a>
<pre class="prettyprint">
<div class="ui-grid-col-3" style="height:76px">
<button type="button" class="ui-btn">Button Circle</button>
- <a href="#" class="ui-btn ui-color-red" >A Button Circle</a>
- <input type="button" class="ui-btn ui-color-orange" value="Input Button Circle" />
+ <a href="#" class="ui-btn ui-color-red">A Button Circle</a>
+ <input type="button" class="ui-btn ui-color-orange" value="Input Button Circle"/>
</div>
</pre></li>
<pre class="prettyprint">
<div class="ui-grid-row">
<button type="button" class="ui-btn">Button Circle</button>
- <a href="#" class="ui-btn ui-color-red" >A Button Circle</a>
- <input type="button" class="ui-btn ui-color-orange" value="Input Button Circle" />
+ <a href="#" class="ui-btn ui-color-red">A Button Circle</a>
+ <input type="button" class="ui-btn ui-color-orange" value="Input Button Circle"/>
</div>
</pre></li></ul>
<p>The radio button component shows a list of options on the screen where only 1 option can be selected. To add a radio button component to the application, use the following code:</p>
<pre class="prettyprint">
-<input type="radio" name="radioset" id="radio-1" />
+<input type="radio" name="radioset" id="radio-1"/>
<label for="radio-1">Radio</label>
</pre>
<p>To add a checkbox or radio button to a list, use the following code:</p>
<pre class="prettyprint">
<ul class="ui-listview">
- <li class="li-has-radio">
- <label>
- Radio checked
- <input type="radio" name="radioset" checked="checked" />
- </label>
- </li>
- <li class="li-has-radio">
- <label>
- Radio button
- <input type="radio" name="radioset" />
- </label>
- </li>
- </label>
- </li>
- <li class="li-has-radio disabled">
- <label>
- Radio disabled
- <input type="radio" name="radioset" disabled="disabled"/>
- </label>
- </li>
+ <li class="li-has-radio">
+ <label>
+ Radio checked
+ <input type="radio" name="radioset" checked="checked"/>
+ </label>
+ </li>
+ <li class="li-has-radio">
+ <label>
+ Radio button
+ <input type="radio" name="radioset"/>
+ </label>
+ </li>
+ </label>
+ </li>
+ <li class="li-has-radio disabled">
+ <label>
+ Radio disabled
+ <input type="radio" name="radioset" disabled="disabled"/>
+ </label>
+ </li>
</ul>
</pre>
<p>If you don't make any "circleprogress" with <progress> element, you can show default progress style.<br>
To add a CircleProgressBar component to the application, use the following code:</p>
-<pre class="prettyprint"><div class="ui-page" id="pageCircleProgressBar">
- <header class="ui-header"></header>
- <div class="ui-content">
- <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
- </div>
+<pre class="prettyprint">
+<div class="ui-page" id="pageCircleProgressBar">
+ <header class="ui-header"></header>
+ <div class="ui-content">
+ <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
+ </div>
</div>
<script>
- (function(){
-
- var page = document.getElementById( "pageCircleProgressBar" ),
- progressBar = document.getElementById("circleprogress"),
- progressBarWidget;
-
- page.addEventListener( "pageshow", function() {
- // make Circle Progressbar object
- progressBarWidget = new tau.widget.CircleProgressBar(progressBar);
-
- });
-
- page.addEventListener( "pagehide", function() {
- // release object
- progressBarWidget.destroy();
- });
- }());
+ (function()
+ {
+ var page = document.getElementById("pageCircleProgressBar"),
+ progressBar = document.getElementById("circleprogress"),
+ progressBarWidget;
+
+ page.addEventListener("pageshow", function()
+ {
+ /* Make Circle Progressbar object */
+ progressBarWidget = new tau.widget.CircleProgressBar(progressBar);
+ });
+
+ page.addEventListener("pagehide", function()
+ {
+ /* Release object */
+ progressBarWidget.destroy();
+ });
+ }());
</script>
</pre>
<br> And in your javascript code, you have to add option "size: full".
<br> Be sure to place the <progress> element outside of content element.
</p>
-<pre class="prettyprint"><div class="ui-page" id="pageCircleProgressBar">
- <header class="ui-header"></header>
- <div class="ui-content"></div>
- <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
+<pre class="prettyprint">
+<div class="ui-page" id="pageCircleProgressBar">
+ <header class="ui-header"></header>
+ <div class="ui-content"></div>
+ <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
</div>
<script>
- (function(){
-
- var page = document.getElementById( "pageCircleProgressBar" ),
- progressBar = document.getElementById("circleprogress"),
- progressBarWidget;
-
- page.addEventListener( "pageshow", function() {
- // make Circle Progressbar object
- progressBarWidget = new tau.widget.CircleProgressBar(progressBar, {size: "full"});
-
- });
-
- page.addEventListener( "pagehide", function() {
- // release object
- progressBarWidget.destroy();
- });
- }());
+ (function()
+ {
+ var page = document.getElementById("pageCircleProgressBar"),
+ progressBar = document.getElementById("circleprogress"),
+ progressBarWidget;
+
+ page.addEventListener("pageshow", function()
+ {
+ /* Make Circle Progressbar object */
+ progressBarWidget = new tau.widget.CircleProgressBar(progressBar, {size: "full"});
+ });
+
+ page.addEventListener("pagehide", function()
+ {
+ /* Release object */
+ progressBarWidget.destroy();
+ });
+ }());
</script>
</pre>
The following shows how to use "progresschange" event.
<pre class="prettyprint">
-progressBar.addEventListener("progresschange", function() {
- // do something when the value of progress changes
- console.log(progressBarWidget.value());
+progressBar.addEventListener("progresschange", function()
+{
+ /* Do something when the value of progress changes */
+ console.log(progressBarWidget.value());
});
</pre>
<tr>
<td>
- <pre class="intable prettyprint">string <a href="#method-value">value</a> ( ) </pre>
+ <pre class="intable prettyprint">string <a href="#method-value">value</a>() </pre>
</td>
<td><p>Get or Set value of the widget</p></td>
</tr>
<p>Get or Set value of the widget</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">string value ( ) </pre>
+ <pre class="signature prettyprint">string value() </pre>
</div>
<p><span class="version">Since: </span>
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
- <pre name="code" class="examplecode
- prettyprint">
- <div class="ui-page" id="pageCircleProgressBar">
- <header class="ui-header">
- <h2 class="ui-title">Circle Progress Bar</h2>
- </header>
- <div class="ui-content content-padding"> Circle Progress Bar
- <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
- </div>
- </div>
-
- <script>
- var page = document.getElementById( "pageCircleProgressBar" );
-
- page.addEventListener( "pageshow", function() {
- var progressbar = document.getElementById("circleprogress"),
- progressbarWidget = tau.widget.CircleProgressBar(progressbar),
- // return value in progress tag
- value = progressbarWidget.value();
- // sets the value for the progress
- progressbarWidget.value("15");
- });
- </script>
+<pre name="code" class="examplecode prettyprint">
+<div class="ui-page" id="pageCircleProgressBar">
+ <header class="ui-header">
+ <h2 class="ui-title">Circle Progress Bar</h2>
+ </header>
+ <div class="ui-content content-padding">Circle Progress Bar
+ <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
+ </div>
+</div>
+
+<script>
+ var page = document.getElementById("pageCircleProgressBar");
+
+ page.addEventListener("pageshow", function()
+ {
+ var progressbar = document.getElementById("circleprogress"),
+ progressbarWidget = tau.widget.CircleProgressBar(progressbar),
+ /* Return value in progress tag */
+ value = progressbarWidget.value();
+ /* Set the value for the progress */
+ progressbarWidget.value("15");
+ });
+</script>
</pre>
</div>
<p>For manual creation of circular index scroll bar, you can use constructor from <strong>tau</strong> namespace:</p>
<pre class="prettyprint">var circularindexElement = document.getElementById('circularindexscrollbar'),
- circularindexscrollbar = tau.widget.CircularIndexScrollbar(circularindexElement, {index: "A,B,C"});
+ circularindexscrollbar = tau.widget.CircularIndexScrollbar(circularindexElement, {index: "A,B,C"});
</pre>
<p>Constructor has one require parameter <strong>element</strong> which are base <strong>HTMLElement</strong> to create component. We recommend get this element by method <em>document.getElementById</em>.</p>
<p>To add a circular index scroll bar component to the application, use the following code:</p>
-<pre class="prettyprint"> <div id="indexscrollbar" class="ui-circularindexscrollbar" data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"></div>
- <script>
- (function() {
- var elem = document.getElementById("indexscrollbar");
- tau.widget.CircularIndexScrollbar(elem);
- elem.addEventListener("select", function( event ) {
- var index = event.detail.index;
- // Print selected index
- console.log(index);
- });
- }());
- </script>
+<pre class="prettyprint">
+<div id="indexscrollbar" class="ui-circularindexscrollbar"
+ data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"></div>
+<script>
+ (function()
+ {
+ var elem = document.getElementById("indexscrollbar");
+ tau.widget.CircularIndexScrollbar(elem);
+ elem.addEventListener("select", function(event)
+ {
+ var index = event.detail.index;
+ /* Print selected index */
+ console.log(index);
+ });
+ }());
+</script>
</pre>
<p>The index value can be retrieved by accessing event.detail.index property.</p>
<p>In the following example, the list scrolls to the position of the list item defined using the li-divider class which is selected by the circular index scroll bar:</p>
<pre class="prettyprint">
- <div id="pageIndexScrollbar" class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">CircularIndexScrollbar</h2>
- </header>
- <div id="indexscrollbar" class="ui-circularindexscrollbar"></div>
- <section class="ui-content">
- <ul class="ui-listview" id="list1">
- <li class="li-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li>Art</li>
- <li class="li-divider">B</li>
- <li>Barry</li>
- <li>Bibi</li>
- <li>Billy</li>
- <li>Bob</li>
- <li class="li-divider">D</li>
- <li>Daisy</li>
- <li>Derek</li>
- <li>Desmond</li>
- </ul>
- </section>
+<div id="pageIndexScrollbar" class="ui-page">
+ <header class="ui-header">
+ <h2 class="ui-title">CircularIndexScrollbar</h2>
+ </header>
+ <div id="indexscrollbar" class="ui-circularindexscrollbar"></div>
+ <section class="ui-content">
+ <ul class="ui-listview" id="list1">
+ <li class="li-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li>Art</li>
+ <li class="li-divider">B</li>
+ <li>Barry</li>
+ <li>Bibi</li>
+ <li>Billy</li>
+ <li>Bob</li>
+ <li class="li-divider">D</li>
+ <li>Daisy</li>
+ <li>Derek</li>
+ <li>Desmond</li>
+ </ul>
+ </section>
</div>
<script>
-(function() {
- var page = document.getElementById("pageIndexScrollbar"),
- indexScrollbar;
-
- page.addEventListener("pageshow", function(ev) {
- var indexScrollbarElement = document.getElementById("indexscrollbar"),
- listviewElement = document.getElementById("list1"), // list
- listDividers = listviewElement.getElementsByClassName("li-divider"), // list dividers
- dividers = {}, // collection of list dividers
- indices = [], // index list
- scroller,
- divider,
- i, idx;
-
- // For all list dividers,
- for(i = 0; i < listDividers.length; i++) {
- // Add the list divider elements to the collection
- divider = listDividers[i];
- idx = divider.innerText;
- dividers[idx] = divider;
-
- // Add the index to the index list
- indices.push(idx);
- }
-
- scroller = tau.util.selectors.getScrollableParent(listviewElement);
-
- // Create CircularIndexScrollbar
- indexScrollbar = new tau.widget.CircularIndexScrollbar(indexScrollbarElement, {index: indices});
-
- // Add SnapListview item "selected" event handler.
- // You should update the information for current index
- listviewElement.addEventListener("selected", function (ev) {
- var indexValue = ev.target.textContent[0];
- indexScrollbar.value(indexValue);
- });
-
- // Add IndexScrollbar index "select" event handler.
- indexScrollbarElement.addEventListener("select", function (ev) {
- var divider,
- idx = ev.detail.index;
-
- divider = dividers[idx];
- if(divider && scroller) {
- // Scroll to the li-divider element
- scroller.scrollTop = divider.offsetTop - scroller.offsetTop;
- }
- });
- });
-
- page.addEventListener("pagehide", function(ev) {
- indexScrollbar.destroy();
- });
-} ());
+ (function()
+ {
+ var page = document.getElementById("pageIndexScrollbar"),
+ indexScrollbar;
+
+ page.addEventListener("pageshow", function(ev)
+ {
+ var indexScrollbarElement = document.getElementById("indexscrollbar"),
+ listviewElement = document.getElementById("list1"), /* List */
+ listDividers = listviewElement.getElementsByClassName("li-divider"), /* List dividers */
+ dividers = {}, /* Collection of list dividers */
+ indices = [], /* Index list */
+ scroller,
+ divider,
+ i, idx;
+
+ /* For all list dividers, */
+ for (i = 0; i < listDividers.length; i++)
+ {
+ /* Add the list divider elements to the collection */
+ divider = listDividers[i];
+ idx = divider.innerText;
+ dividers[idx] = divider;
+
+ /* Add the index to the index list */
+ indices.push(idx);
+ }
+
+ scroller = tau.util.selectors.getScrollableParent(listviewElement);
+
+ /* Create CircularIndexScrollbar */
+ indexScrollbar = new tau.widget.CircularIndexScrollbar(indexScrollbarElement, {index: indices});
+
+ /* Add SnapListview item "selected" event handler */
+ /* You should update the information for current index */
+ listviewElement.addEventListener("selected", function(ev)
+ {
+ var indexValue = ev.target.textContent[0];
+ indexScrollbar.value(indexValue);
+ });
+
+ /* Add IndexScrollbar index "select" event handler */
+ indexScrollbarElement.addEventListener("select", function(ev)
+ {
+ var divider,
+ idx = ev.detail.index;
+
+ divider = dividers[idx];
+ if (divider && scroller)
+ {
+ /* Scroll to the li-divider element */
+ scroller.scrollTop = divider.offsetTop - scroller.offsetTop;
+ }
+ });
+ });
+
+ page.addEventListener("pagehide", function(ev)
+ {
+ indexScrollbar.destroy();
+ });
+ }());
</script>
</pre>
<tr>
<td>
- <pre class="intable prettyprint">string <a href="#method-value">value</a> ( ) </pre>
+ <pre class="intable prettyprint">string <a href="#method-value">value</a>() </pre>
</td>
<td><p>Get or Set index of the circular index scroll bar</p></td>
</tr>
<p>Get or Set index of the circular index scroll bar</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">string value ( ) </pre>
+ <pre class="signature prettyprint">string value() </pre>
</div>
<div class="description">
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
- <div id="circularindexscrollbar"></div>
- <script>
- var circularindexElement = document.getElementById("circularindexscrollbar"),
- circularIndexScrollbar = tau.widget.CircularIndexScrollbar(circularindexElement),
- // return current index value
- value = circularIndexScrollbar.value();
- // sets the index value
- circularIndexScrollbar.value("C");
- </script>
+<div id="circularindexscrollbar"></div>
+<script>
+ var circularindexElement = document.getElementById("circularindexscrollbar"),
+ circularIndexScrollbar = tau.widget.CircularIndexScrollbar(circularindexElement),
+ /* Return current index value */
+ value = circularIndexScrollbar.value();
+ /* Set the index value */
+ circularIndexScrollbar.value("C");
+</script>
</pre>
</div>
</table>
<h3>HTML</h3>
-<pre class="prettyprint"> <div id="moreoptionsPage" class="ui-page">
- <header class="ui-header ui-has-more">
- <h2 class="ui-title">Drawer</h2>
- <button class="ui-more ui-icon-overflow">Drawer</button>
- </header>
- <div class="ui-content content-padding">
- Drawer
- </div>
-
- <!-- Circle Profile -->
- <div id="moreoptionsDrawer" class="ui-drawer" data-drawer-target="#moretionsPage" data-position="right" data-enable="true" data-drag-edge="1">
- <div id="moreoptionsSectionChanger" class="ui-section-changer">
- <div>
- <seciont>
- <button class="option-button">1</button>
- </seciont>
- <seciont>
- <button class="option-button">2</button>
- </seciont>
- <seciont>
- <button class="option-button">3</button>
- </seciont>
- </div>
- </div>
- </div>
- </div>
+<pre class="prettyprint">
+<div id="moreoptionsPage" class="ui-page">
+ <header class="ui-header ui-has-more">
+ <h2 class="ui-title">Drawer</h2>
+ <button class="ui-more ui-icon-overflow">Drawer</button>
+ </header>
+ <div class="ui-content content-padding">
+ Drawer
+ </div>
+
+ <!--Circle Profile-->
+ <div id="moreoptionsDrawer" class="ui-drawer" data-drawer-target="#moretionsPage" data-position="right"
+ data-enable="true" data-drag-edge="1">
+ <div id="moreoptionsSectionChanger" class="ui-section-changer">
+ <div>
+ <seciont>
+ <button class="option-button">1</button>
+ </seciont>
+ <seciont>
+ <button class="option-button">2</button>
+ </seciont>
+ <seciont>
+ <button class="option-button">3</button>
+ </seciont>
+ </div>
+ </div>
+ </div>
+</div>
</pre>
<h3>JavaScript</h3>
-<pre class="prettyprint">(function(){
- var page = document.querySelector("#moreoptionsPage"),
- popup = page.querySelector("#moreoptionsPopup"),
- drawer = page.querySelector("#moreoptionsDrawer"),
- handler = page.querySelector(".ui-more");
-
- page.addEventListener( "pagebeforeshow", function() {
- var popupWidget;
-
-
- tau.helper.DrawerMoreStyle.create(drawer, {
- handler: ".ui-more",
- });
- });
- })();</pre>
+<pre class="prettyprint">
+(function()
+{
+ var page = document.querySelector("#moreoptionsPage"),
+ popup = page.querySelector("#moreoptionsPopup"),
+ drawer = page.querySelector("#moreoptionsDrawer"),
+ handler = page.querySelector(".ui-more");
+
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var popupWidget;
+
+ tau.helper.DrawerMoreStyle.create(drawer, {handler: ".ui-more",});
+ });
+})();</pre>
<h3>CSS</h3>
<pre class="prettyprint">
-#moreoptionsDrawer {
- display: none;
+#moreoptionsDrawer
+{
+ display: none;
}
-@media all and (-tizen-geometric-shape: circle) {
- #moreoptionsDrawer {
- display: block;
- background-color: rgba(255, 255, 255, 0.1);
- border-radius: 100%;
- }
-
- #moreoptionsPopup {
- display: none;
- }
- .sections,
- .options {
- text-align: center;
- }
- .option-button {
- width: 158px;
- height: 158px;
- background-color: #a4a4a4;
- position: relative;
- left: 50%;
- transform: translate3d(-50%, -50%, 0);
- top: 50%;
- border-radius: 50%;
- border: none;
- text-align: center;
- line-height: 158px;
- -webkit-appearance: none;
- }
+@media all and (-tizen-geometric-shape: circle)
+{
+ #moreoptionsDrawer
+ {
+ display: block;
+ background-color: rgba(255, 255, 255, 0.1);
+ border-radius: 100%;
+ }
+ #moreoptionsPopup
+ {
+ display: none;
+ }
+ .sections,
+ .options
+ {
+ text-align: center;
+ }
+ .option-button
+ {
+ width: 158px;
+ height: 158px;
+ background-color: #a4a4a4;
+ position: relative;
+ left: 50%;
+ transform: translate3d(-50%, -50%, 0);
+ top: 50%;
+ border-radius: 50%;
+ border: none;
+ text-align: center;
+ line-height: 158px;
+ -webkit-appearance: none;
+ }
}
</pre>
<h3>Drawer positioning</h3>
You can declare to 'position' option as below method.
-<pre class="prettyprint"> <div class="ui-drawer" data-position="left" id="leftdrawer">
+<pre class="prettyprint"><div class="ui-drawer" data-position="left" id="leftdrawer">
</pre>
<h3>Drawer targeting</h3>
You can declare to 'drawerTarget' option as below method.
-<pre class="prettyprint"> <div class="ui-drawer" data-drawer-target="#drawerPage">
+<pre class="prettyprint"><div class="ui-drawer" data-drawer-target="#drawerPage">
</pre>
<h3>Drawer enable</h3>
You can declare to 'enable' option as below method.
-<pre class="prettyprint"> <div class="ui-drawer" data-enable="true">
+<pre class="prettyprint"><div class="ui-drawer" data-enable="true">
</pre>
<h3>Drawer drag gesture starting area</h3>
You can declare to 'enable' option as below method.
-<pre class="prettyprint"> <div class="ui-drawer" data-drag-edge="1">
+<pre class="prettyprint"><div class="ui-drawer" data-drag-edge="1">
</pre>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-setDragHandler">setDragHandler</a> ( Element element ) </pre>
+ <pre class="intable prettyprint"><a href="#method-setDragHandler">setDragHandler</a>(Element element) </pre>
</td>
<td><p>Set Drawer drag handler.<br />If developer use handler, drag event is bound at handler only.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-transition">transition</a> ( Integer position ) </pre>
+ <pre class="intable prettyprint"><a href="#method-transition">transition</a>(Integer position) </pre>
</td>
<td><p>Transition Drawer.<br />This method use only positive integer number.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-open">open</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Open Drawer.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-close">close</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Close Drawer.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint">String <a href="#method-getState">getState</a> ( ) </pre>
+ <pre class="intable prettyprint">String <a href="#method-getState">getState</a>() </pre>
</td>
<td><p>Get state of Drawer.</p></td>
</tr>
<p>Set Drawer drag handler.<br />If developer use handler, drag event is bound at handler only.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">setDragHandler ( Element element) </pre>
+ <pre class="signature prettyprint">setDragHandler(Element element) </pre>
</div>
<div class="description">
<h5>Running example in pure JavaScript:</h5>
</p>
<pre class="prettyprint">
-<!-- Drawer Handlers -->
+<!--Drawer handlers-->
<a id="leftDrawerHandler" href="#leftDrawer" class="drawer-handler">Left Handler</a>
-<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left" data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
-var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
-drawer.setDragHandler(handler);
+ drawer.setDragHandler(handler);
</script></pre>
</div>
<p>Transition Drawer.<br />This method use only positive integer number.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">transition ( Integer position) </pre>
+ <pre class="signature prettyprint">transition(Integer position) </pre>
</div>
<div class="description">
<h5>Running example in pure JavaScript:</h5>
<pre class="prettyprint">
<a id="leftDrawerHandler" href="#leftDrawer" class="drawer-handler">Left Handler</a>
-<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left" data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
-var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
-drawer.Transition(60);
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
+ drawer.Transition(60);
</script></pre>
</p>
<p>Open Drawer.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">open ( ) </pre>
+ <pre class="signature prettyprint">open() </pre>
</div>
<div class="description">
<p>
<h5>Running example in pure JavaScript:</h5>
<pre class="prettyprint">
-<!-- Drawer Handlers -->
-<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left" data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+<!--Drawer handlers-->
+<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
- var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
- drawer.open();
+ drawer.open();
</script></pre>
</p>
<p>Close Drawer.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">close ( ) </pre>
+ <pre class="signature prettyprint">close() </pre>
</div>
<div class="description">
<p>
<h5>Running example in pure JavaScript:</h5>
<pre class="prettyprint">
-<!-- Drawer Handlers -->
-<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left" data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+<!--Drawer handlers-->
+<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
- var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
- drawer.close();
+ drawer.close();
</script></pre>
</p>
<p>Get state of Drawer.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">String getState ( ) </pre>
+ <pre class="signature prettyprint">String getState() </pre>
</div>
<div class="description">
<p>
<h5>Running example in pure JavaScript:</h5>
<pre class="prettyprint">
-<!-- Drawer Handlers -->
-<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left" data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+<!--Drawer handlers-->
+<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
- var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href")),
- state;
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href")),
+ state;
- state = drawer.getState();
+ state = drawer.getState();
</script></pre>
</p>
<h2><a id='manual-constructor0.6990520032122731'></a>How to create index scroll bar</h2>
<p>For manual creation of Index Scroll Bar, you can use constructor from <strong>tau</strong> namespace:</p>
-<pre class="prettyprint">var indexElement = document.getElementById('indexscrollbar'),
- indexscrollbar = tau.widget.IndexScrollbar(indexElement);
+<pre class="prettyprint">
+var indexElement = document.getElementById('indexscrollbar'),
+ indexscrollbar = tau.widget.IndexScrollbar(indexElement);
</pre>
<p>To add an index scroll bar component to the application, use the following code:</p>
<pre class="prettyprint">
indices.push(idx);
}
- /* Change the data-index attribute to the index scroll bar element */
- /* before initializing index scroll bar component */
+ /*
+ Change the data-index attribute to the index scroll bar element
+ before initializing index scroll bar component
+ */
elem.setAttribute("data-index", indices.join(","));
/* Create index scroll bar */
elItems = elList.children,
elScroller = elList.parentElement, /* Scroller (overflow-y:hidden) */
indexData = getIndexData(
- {
- array: elItems,
- getTextValue: function(array, i) {return array[i].innerText;}
- });
+ {
+ array: elItems,
+ getTextValue: function(array, i) {return array[i].innerText;}
+ });
function getIndexData(options)
{
<pre class="prettyprint">
<div class="ui-page ui-page-active" id="marqueePage" >
- <header class="ui-header">
- <h2 class="ui-title">Marquee</h2>
- </header>
- <div class="ui-content">
- <ul class="ui-listview">
- <li><div class="ui-marquee" id="marquee">Marquee code sample</div></li>
- </ul>
- </div>
+ <header class="ui-header">
+ <h2 class="ui-title">Marquee</h2>
+ </header>
+ <div class="ui-content">
+ <ul class="ui-listview">
+ <li><div class="ui-marquee" id="marquee">Marquee code sample</div></li>
+ </ul>
+ </div>
</div>
<script>
- var page = document.querySelector("#marqueePage");
+ var page = document.querySelector("#marqueePage");
- page.addEventListener( "pagebeforeshow", function() {
- var marqueeEl = document.getElementById("marquee"),
- marqueeWidget = new tau.widget.Marquee(marqueeEl, {marqueeStyle: "scroll", delay: "3"});
- });
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var marqueeEl = document.getElementById("marquee"),
+ marqueeWidget = new tau.widget.Marquee(marqueeEl, {marqueeStyle: "scroll", delay: "3"});
+ });
</script>
</pre>
<tbody>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-start">start</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-start">start</a>() </pre>
</td>
<td><p>Start Marquee animation</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-stop">stop</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-stop">stop</a>() </pre>
</td>
<td><p>Stop Marquee animation</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-reset">reset</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-reset">reset</a>() </pre>
</td>
<td><p>Reset Marquee animation</p></td>
</tr>
<p>Start Marquee animation</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">start ( ) </pre>
+ <pre class="signature prettyprint">start() </pre>
</div>
<div class="description">
<pre name="code" class="examplecode
prettyprint">
<div class="ui-marquee" id="marquee">
- <p>MarqueeTEST TEST message TEST for marquee</p>
+ <p>MarqueeTEST TEST message TEST for marquee</p>
</div>
<script>
- var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
- marqueeWidget.start();
+ var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
+ marqueeWidget.start();
</script>
</pre>
</div>
<p>Stop Marquee animation</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">stop ( ) </pre>
+ <pre class="signature prettyprint">stop() </pre>
</div>
<div class="description">
<pre name="code" class="examplecode
prettyprint">
<div class="ui-marquee" id="marquee">
- <p>MarqueeTEST TEST message TEST for marquee</p>
+ <p>MarqueeTEST TEST message TEST for marquee</p>
</div>
<script>
- var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
- marqueeWidget.stop();
+ var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
+ marqueeWidget.stop();
</script>
</pre>
</div>
<p>Reset Marquee animation (reset and end)</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">reset ( ) </pre>
+ <pre class="signature prettyprint">reset() </pre>
</div>
<div class="description">
<pre name="code" class="examplecode
prettyprint">
<div class="ui-marquee" id="marquee">
- <p>MarqueeTEST TEST message TEST for marquee</p>
+ <p>MarqueeTEST TEST message TEST for marquee</p>
</div>
<script>
- var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
- marqueeWidget.reset();
+ var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
+ marqueeWidget.reset();
</script>
</pre>
</div>
<p>For manual creation of page indicator, you can use constructor from <strong>tau</strong> namespace:</p>
-<pre class="prettyprint">var elPageIndicator = document.getElementById("pageindicator"),
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, { numberOfPages : 5 });
+<pre class="prettyprint">
+var elPageIndicator = document.getElementById("pageindicator"),
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages : 5});
</pre>
<p>Constructor has two require parameter <strong>element</strong> which are base <strong>HTMLElement</strong> to create component. We recommend get this element by method <em>document.getElementById</em>. Second parameter is <strong>options</strong> and it is a object with options for component. numberOfPages means the number of pages to be linked and it is mandatory.</p>
<p>To add an page indicator component to the application, use the following code:</p>
-<pre class="prettyprint"> <div id="pageIndicator" class="ui-page-indicator"></div>
- <script>
- var elPageIndicator = document.getElementById("pageIndicator"),
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, { numberOfPages: 5 }),
- index = 1;
- pageIndicator.setActive(index);
+<pre class="prettyprint">
+<div id="pageIndicator" class="ui-page-indicator"></div>
+<script>
+ var elPageIndicator = document.getElementById("pageIndicator"),
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5}),
+ index = 1;
+ pageIndicator.setActive(index);
</script>
</pre>
<pre class="prettyprint">
<div id="pageIndicatorPage" class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">Page Indicator</h2>
- </header>
- <div id="pageIndicator" class="ui-page-indicator"></div>
- <div id="hsectionchanger" class="ui-content">
- <div>
- <section class="ui-section-active" style="text-align:center" >
- <h3> Page1 of 5</h3>
- </section>
- <section style="text-align:center">
- <h3> Page2 of 5</h3>
- </section>
- <section style="text-align:center">
- <h3> Page3 of 5</h3>
- </section>
- <section style="text-align:center">
- <h3> Page4 of 5 </h3>
- </section>
- <section style="text-align:center">
- <h3> Page5 of 5 </h3>
- </section>
- </div>
- </div>
- <script>
- (function() {
- var self = this,
- page = document.getElementById( "pageIndicatorPage" ),
- changer = document.getElementById( "hsectionchanger" ),
- sectionChanger,
- elPageIndicator = document.getElementById("pageIndicator"),
- pageIndicator,
- pageIndicatorHandler;
-
- page.addEventListener( "pagebeforeshow", function() {
- // Create PageIndicator
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, { numberOfPages: 5 });
- pageIndicator.setActive(0);
-
- sectionChanger = new tau.widget.SectionChanger(changer, {
- circular: true,
- orientation: "horizontal",
- useBouncingEffect: true
- });
- });
-
- page.addEventListener( "pagehide", function() {
- sectionChanger.destroy();
- pageIndicator.destroy();
- });
-
- // Indicator setting handler
- pageIndicatorHandler = function (e) {
- pageIndicator.setActive(e.detail.active);
- };
-
- // Bind the callback
- changer.addEventListener("sectionchange", pageIndicatorHandler, false);
- })();
- </script>
+ <header class="ui-header">
+ <h2 class="ui-title">Page Indicator</h2>
+ </header>
+ <div id="pageIndicator" class="ui-page-indicator"></div>
+ <div id="hsectionchanger" class="ui-content">
+ <div>
+ <section class="ui-section-active" style="text-align:center" >
+ <h3> Page1 of 5</h3>
+ </section>
+ <section style="text-align:center">
+ <h3> Page2 of 5</h3>
+ </section>
+ <section style="text-align:center">
+ <h3> Page3 of 5</h3>
+ </section>
+ <section style="text-align:center">
+ <h3> Page4 of 5</h3>
+ </section>
+ <section style="text-align:center">
+ <h3> Page5 of 5</h3>
+ </section>
+ </div>
+ </div>
+ <script>
+ (function()
+ {
+ var self = this,
+ page = document.getElementById("pageIndicatorPage"),
+ changer = document.getElementById("hsectionchanger"),
+ sectionChanger,
+ elPageIndicator = document.getElementById("pageIndicator"),
+ pageIndicator,
+ pageIndicatorHandler;
+
+ page.addEventListener("pagebeforeshow", function()
+ {
+ /* Create PageIndicator */
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5});
+ pageIndicator.setActive(0);
+
+ sectionChanger = new tau.widget.SectionChanger(changer,
+ {
+ circular: true,
+ orientation: "horizontal",
+ useBouncingEffect: true
+ });
+ });
+
+ page.addEventListener("pagehide", function()
+ {
+ sectionChanger.destroy();
+ pageIndicator.destroy();
+ });
+
+ /* Indicator setting handler */
+ pageIndicatorHandler = function(e)
+ {
+ pageIndicator.setActive(e.detail.active);
+ };
+
+ /* Bind the callback */
+ changer.addEventListener("sectionchange", pageIndicatorHandler, false);
+ })();
+ </script>
</div>
</pre>
<p>If you use the following statement when you create page indicator component, a central dot is assigned to multiple pages.</p>
<pre class="prettyprint">
-pageIndicator = tau.widget.PageIndicator(elPageIndicator, { numberOfPages: 5, maxPage: 3 });
+pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5, maxPage: 3});
</pre>
<h2><a id="options-list"></a>Options</h2>
</table>
<br>
<p>
-Take an example : the situation that the value of numberOfPages is "5"(5 pages in all), and the value of maxPage is "3"(3 dots).<br>
-When you scroll the page(or section) horizontally, the number of exceeding pages( in this case, it is 2 pages, which is the result of 5 - 3 )<br>
+Take an example : the situation that the value of numberOfPages is "5" (5 pages in all), and the value of maxPage is "3" (3 dots).<br>
+When you scroll the page (or section) horizontally, the number of exceeding pages (in this case, it is 2 pages, which is the result of 5 - 3)<br>
would be indicated by the central dot, from middle of the pages.<br>
<br>
-So, the first dot is for the first page, and the last dot is for the fifth( the last) page.<br>
+So, the first dot is for the first page, and the last dot is for the fifth (the last) page.<br>
And the middle dot is shared by 2nd, 3rd and 4th page while scrolling pages.<br>
<br>
-In the case of even value of maxPage( the number of dots on the screen), the next order of half of the maxPage value would work as middle dot.<br>
-For example, in the situation that the value of numberOfPages is "6", and the value of maxPage is "4", the 3rd dot( the result of 4 / 2 + 1) would indicate
+In the case of even value of maxPage (the number of dots on the screen), the next order of half of the maxPage value would work as middle dot.<br>
+For example, in the situation that the value of numberOfPages is "6", and the value of maxPage is "4", the 3rd dot (the result of 4 / 2 + 1) would indicate
3rd, 4th and 5th pages as middle dot.<br>
<br>
Of course, the value of numberOfPages should meet the number of the pages you have added to HTML.<br>
<br>
-And if the the value of maxPage(dots) exceeds the value of numberOfPages, the value of maxPage would be changed to the value of numberOfPages.<br>
+And if the the value of maxPage (dots) exceeds the value of numberOfPages, the value of maxPage would be changed to the value of numberOfPages.<br>
For example, in the situation that the value of numberOfPages is "6", and the value of maxPage is "100",there would be still 6 dots on the screen.
</P>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-setActive">setActive</a> ( number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-setActive">setActive</a>(number index) </pre>
</td>
<td><p>This method sets a dot to active state.</p></td>
</tr>
<p>This method sets a dot to active state.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">setActive ( number index) </pre>
+ <pre class="signature prettyprint">setActive(number index) </pre>
</div>
<div class="description">
<ul class="ui-listview">
<li>
<label for="check-1" class="ui-popup-checkbox-label">Yesterday</label>
- <input type="checkbox" name="checkset" id="check-1" />
+ <input type="checkbox" name="checkset" id="check-1"/>
</li>
<li>
<label for="check-2" class="ui-popup-checkbox-label">Today</label>
- <input type="checkbox" name="checkset" id="check-2" />
+ <input type="checkbox" name="checkset" id="check-2"/>
</li>
<li>
<label for="check-3" class="ui-popup-checkbox-label">Tomorrow</label>
- <input type="checkbox" name="checkset" id="check-3" />
+ <input type="checkbox" name="checkset" id="check-3"/>
</li>
</ul>
<ul class="ui-listview">
<li>
<label for="radio-1" class="ui-popup-radio-label">Mandatory</label>
- <input type="radio" name="radioset" id="radio-1" />
+ <input type="radio" name="radioset" id="radio-1"/>
</li>
<li>
<label for="radio-2" class="ui-popup-radio-label">Optional</label>
- <input type="radio" name="radioset" id="radio-2" />
+ <input type="radio" name="radioset" id="radio-2"/>
</li>
</ul>
</div>
<p>To bind the popup to a button, use the following code:</p>
-<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><!--HTML code-->
+<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
+<!--HTML code-->
<div id="1btnPopup" class="ui-popup">
- <div class="ui-popup-header">Power saving mode</div>
- <div class="ui-popup-content">
- </div>
- <div class="ui-popup-footer">
+ <div class="ui-popup-header">Power saving mode</div>
+ <div class="ui-popup-content"></div>
+ <div class="ui-popup-footer">
<button id="1btnPopup-cancel" class="ui-btn">Cancel</button>
</div>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
</table>
<p>To use popup events, use the following code:</p>
-<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><!--Popup html code-->
+<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
+<!--Popup HTML code-->
<div id="popup" class="ui-popup">
- <div class="ui-popup-header"></div>
- <div class="ui-popup-content"></div>
- </div>
+ <div class="ui-popup-header"></div>
+ <div class="ui-popup-content"></div>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<script>
/* Use popup events */
it might occur exceptional errors or bugs.<br>
So it is highly recommended to handle the feature by using event.</p>
-<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><!--Popup html code-->
+<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
+<!--Popup HTML code-->
<div id="popup" class="ui-popup">
- <div class="ui-popup-content"></div>
- <div class="ui-popup-footer">
+ <div class="ui-popup-content"></div>
+ <div class="ui-popup-footer">
<div class="ui-btn" id="cancel-btn"></div>
- </div>
</div>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<script>
/* Use popup events */
var popup = document.getElementById("popup"),
- cancel = document.getElementById("cancel-btn");
+ cancel = document.getElementById("cancel-btn");
- openButton.addEventListener("click", function() {
- tau.openPopup("#popup");
- });
- popup.addEventListener("popupshow", function(){
+ openButton.addEventListener("click", function()
+ {
+ tau.openPopup("#popup");
+ });
+ popup.addEventListener("popupshow", function()
+ {
console.log("Implement code after popup show completely");
});
- cancel.addEventListener("click", function() {
+ cancel.addEventListener("click", function()
+ {
tau.closePopup();
- console.log(window.getComputedStyle(popup).display);//block - not closed yet.
+ console.log(window.getComputedStyle(popup).display); /* Block - not closed yet */
});
- popup.addEventListener("popuphide", function() {
- console.log(window.getComputedStyle(popup).display); //none - closed completely.
+ popup.addEventListener("popuphide", function()
+ {
+ console.log(window.getComputedStyle(popup).display); /* None - closed completely */
});
</script>
</pre></pre>
</tbody>
</table>
-<pre class="prettyprint"><div class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">Processing</h2>
- </header>
- <div class="ui-content content-padding">
- It was a real pleasure for me to finally get to meet you. My colleagues join me in sending you our holiday...
- </div>
- <div class="ui-processing ui-processing-full-size"></div>
+<pre class="prettyprint">
+<div class="ui-page">
+ <header class="ui-header">
+ <h2 class="ui-title">Processing</h2>
+ </header>
+ <div class="ui-content content-padding">
+ It was a real pleasure for me to finally get to meet you. My colleagues join me in sending you our holiday...
+ </div>
+ <div class="ui-processing ui-processing-full-size"></div>
</div>
</pre>
<h2 id="manual-constructor">How to Create Section Changer</h2>
<p>To add a section changer component to the application, use the following code:</p>
-<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><div id="hasSectionchangerPage" class="ui-page">
+<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
+<div id="hasSectionchangerPage" class="ui-page">
<header class="ui-header">
<h2 class="ui-title">SectionChanger</h2>
</header>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">(function()
{
var page = document.getElementById("hasSectionchangerPage"),
- element = document.getElementById("sectionchanger"),
- sectionChanger, idx=1;
+ element = document.getElementById("sectionchanger"),
+ sectionChanger, idx=1;
- page.addEventListener("pageshow", function() {
+ page.addEventListener("pageshow", function()
+ {
/* Create the SectionChanger object */
- sectionChanger = tau.widget.SectionChanger(element, {
+ sectionChanger = tau.widget.SectionChanger(element,
+ {
circular: true,
orientation: "horizontal",
useBouncingEffect: true
});
});
- page.addEventListener("pagehide", function() {
+ page.addEventListener("pagehide", function()
+ {
/* Release the object */
sectionChanger.destroy();
});
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-setActive">setActiveSection</a> ( number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-setActive">setActiveSection</a>(number index) </pre>
</td>
<td><p>Changes the currently active section element (index).
<br>For smooth scrolling, the <span style="font-family: Courier New,Courier,monospace">duration</span> parameter must be in milliseconds.</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-getActiveSectionIndex">getActiveSectionIndex</a> () </pre>
+ <pre class="intable prettyprint"><a href="#method-getActiveSectionIndex">getActiveSectionIndex</a>() </pre>
</td>
<td><p>Gets the currently active section element's index.
<br>The return value is a number (<span style="font-family: Courier New,Courier,monospace">activeIndex</span>).</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-refresh">refresh</a> () </pre>
+ <pre class="intable prettyprint"><a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Updates the section changer form.
<br>When you add new section dynamically through JavaScript, you must call the <span style="font-family: Courier New,Courier,monospace">refresh()</span> method to update section information.</p></td>
<br>For smooth scrolling, the <span style="font-family: Courier New,Courier,monospace">duration</span> parameter must be in milliseconds.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">setActiveSection ( number index) </pre>
+ <pre class="signature prettyprint">setActiveSection(number index) </pre>
</div>
<div class="description">
<br>The return value is a number (<span style="font-family: Courier New,Courier,monospace">activeIndex</span>).</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">getActiveSectionIndex () </pre>
+ <pre class="signature prettyprint">getActiveSectionIndex() </pre>
</div>
<div class="description">
<br>When you add new section dynamically through JavaScript, you must call the <span style="font-family: Courier New,Courier,monospace">refresh()</span> method to update section information.</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">refresh () </pre>
+ <pre class="signature prettyprint">refresh() </pre>
</div>
<div class="description">
<h2><a id='html-example0.9038220448419452'>How to Create Selector</a></h2>
<h3>HTML example</h3>
-<pre class="prettyprint"> <div class="ui-page ui-page-active" id="main">
- <div id="selector" class="ui-selector">
- <div class="ui-item ui-show-icon" data-title="Show"></div>
- <div class="ui-item ui-human-icon" data-title="Human"></div>
- <div class="ui-item ui-delete-icon" data-title="Delete"></div>
- <div class="ui-item ui-show-icon" data-title="Show"></div>
- <div class="ui-item ui-human-icon" data-title="Human"></div>
- <div class="ui-item ui-delete-icon" data-title="Delete"></div>
- <div class="ui-item ui-x-icon" data-title="X Icon"></div>
- <div class="ui-item ui-fail-icon" data-title="Fail"></div>
- <div class="ui-item ui-show-icon" data-title="Show"></div>
- <div class="ui-item ui-human-icon" data-title="Human"></div>
- <div class="ui-item ui-delete-icon" data-title="Delete"></div>
- </div>
- </div>
+<pre class="prettyprint">
+<div class="ui-page ui-page-active" id="main">
+ <div id="selector" class="ui-selector">
+ <div class="ui-item ui-show-icon" data-title="Show"></div>
+ <div class="ui-item ui-human-icon" data-title="Human"></div>
+ <div class="ui-item ui-delete-icon" data-title="Delete"></div>
+ <div class="ui-item ui-show-icon" data-title="Show"></div>
+ <div class="ui-item ui-human-icon" data-title="Human"></div>
+ <div class="ui-item ui-delete-icon" data-title="Delete"></div>
+ <div class="ui-item ui-x-icon" data-title="X Icon"></div>
+ <div class="ui-item ui-fail-icon" data-title="Fail"></div>
+ <div class="ui-item ui-show-icon" data-title="Show"></div>
+ <div class="ui-item ui-human-icon" data-title="Human"></div>
+ <div class="ui-item ui-delete-icon" data-title="Delete"></div>
+ </div>
+</div>
</pre>
<h3><a id='manual-constructor0.33475646935403347'></a>Manual constructor</h3>
<pre class="prettyprint">
-(function() {
- var page = document.getElementById("selectorPage"),
- selector = document.getElementById("selector"),
- clickBound;
+(function()
+{
+ var page = document.getElementById("selectorPage"),
+ selector = document.getElementById("selector"),
+ clickBound;
- function onClick(event) {
- var activeItem = selector.querySelector(".ui-item-active");
- //console.log(activeItem.getAttribute("data-title"));
- }
- page.addEventListener("pagebeforeshow", function() {
- clickBound = onClick.bind(null);
- tau.widget.Selector(selector);
- selector.addEventListener("click", clickBound, false);
- });
- page.addEventListener("pagebeforehide", function() {
- selector.removeEventListener("click", clickBound, false);
- });
+ function onClick(event)
+ {
+ var activeItem = selector.querySelector(".ui-item-active");
+ /* console.log(activeItem.getAttribute("data-title")); */
+ }
+ page.addEventListener("pagebeforeshow", function()
+ {
+ clickBound = onClick.bind(null);
+ tau.widget.Selector(selector);
+ selector.addEventListener("click", clickBound, false);
+ });
+ page.addEventListener("pagebeforehide", function()
+ {
+ selector.removeEventListener("click", clickBound, false);
+ });
})();
</pre>
<tbody>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-changeItem">changeItem</a> ( Number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-changeItem">changeItem</a>(Number index) </pre>
</td>
<td><p>Change active item on active layer</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-addItem">addItem</a> ( HTMLElement item, Number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-addItem">addItem</a>(HTMLElement item, Number index) </pre>
</td>
<td><p>Add new item</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-removeItem">removeItem</a> ( Number index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-removeItem">removeItem</a>(Number index) </pre>
</td>
<td><p>Remove item on specific layer</p></td>
</tr>
<p>Change active item on active layer</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">changeItem ( Number index) </pre>
+ <pre class="signature prettyprint">changeItem(Number index) </pre>
</div>
<div class="description">
<p>Add new item</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">addItem ( HTMLElement item, Number index) </pre>
+ <pre class="signature prettyprint">addItem(HTMLElement item, Number index) </pre>
</div>
<div class="description">
<p>Remove item on specific layer</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">removeItem ( Number index) </pre>
+ <pre class="signature prettyprint">removeItem(Number index) </pre>
</div>
<div class="description">
<p>To add a slider component to the application, use the following code:</p>
-<pre class="prettyprint"><div class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">Slider</h2>
- </header>
- <div class="ui-content content-padding">
- Slider length can be modified by the width style.
- <input type="range" />
- </div>
+<pre class="prettyprint">
+<div class="ui-page">
+ <header class="ui-header">
+ <h2 class="ui-title">Slider</h2>
+ </header>
+ <div class="ui-content content-padding">
+ Slider length can be modified by the width style.
+ <input type="range"/>
+ </div>
</div>
</pre>
<p>If you want to modify the width of the slider,please change the length with width style.</p>
<p>You can add a basic listview as follows:</p>
-<pre class="prettyprint"><ul class="ui-listview ui-snap-listview" id="snapList">
- <li>1line</li>
- <li>2line</li>
- <li>3line</li>
- <li>4line</li>
- <li>5line</li>
+<pre class="prettyprint">
+<ul class="ui-listview ui-snap-listview" id="snapList">
+ <li>1line</li>
+ <li>2line</li>
+ <li>3line</li>
+ <li>4line</li>
+ <li>5line</li>
</ul>
</pre>
<p>In javascript code, you can make your list as SnapListview component as follows:</p>
-<pre class="prettyprint"><script>
-var snapList = document.getElementById("snapList"),
- snapListComponent = tau.widget.SnapListview(snapList);
+<pre class="prettyprint">
+<script>
+ var snapList = document.getElementById("snapList"),
+ snapListComponent = tau.widget.SnapListview(snapList);
</script>
</pre>
<h3>JavaScript</h3>
<pre class="prettyprint">
-(function() {
+(function()
+{
var page = document.getElementById("pageSwipeList"),
listElement = page.getElementsByClassName("ui-swipelist-list")[0],
swipeList;
- page.addEventListener("pageshow", function() {
+ page.addEventListener("pageshow", function()
+ {
/* Make swipe list object */
- swipeList = new tau.widget.SwipeList(listElement, {
+ swipeList = new tau.widget.SwipeList(listElement,
+ {
swipeTarget: "li",
swipeElement: ".ui-swipelist"
});
});
- page.addEventListener("pagehide", function() {
+ page.addEventListener("pagehide", function()
+ {
/* Release object */
swipeList.destroy();
});
<p>
To add a toggle switch, you must add the <span style="font-family: Courier New,Courier,monospace">ui-switch</span> class in the <span style="font-family: Courier New,Courier,monospace"><div></span> element. Because toggle switch is dependent on the checkbox component, you must implement the <span style="font-family: Courier New,Courier,monospace">ui-switch-input</span> class in a checkbox <span style="font-family: Courier New,Courier,monospace">input</span> element.</p>
<p>To add a toggle switch component to the application, use the following code:</p>
-<pre class="prettyprint"><div class="ui-switch">
- <div class="ui-switch-text">
- Toggle Switch
- </div>
- <label class="ui-toggleswitch">
- <input type="checkbox" class="ui-switch-input">
- <div class="ui-switch-activation">
- <div class="ui-switch-inneroffset">
- <div class="ui-switch-handler"></div>
- </div>
- </div>
- </label>
+<pre class="prettyprint">
+<div class="ui-switch">
+ <div class="ui-switch-text">
+ Toggle Switch
+ </div>
+ <label class="ui-toggleswitch">
+ <input type="checkbox" class="ui-switch-input"/>
+ <div class="ui-switch-activation">
+ <div class="ui-switch-inneroffset">
+ <div class="ui-switch-handler"></div>
+ </div>
+ </div>
+ </label>
</div></pre>
<h3>Toggle Switch in Listview</h3>
<p>You can use toggle switch component in list as checkbox/radio. Please refer following code:</p>
-<pre class="prettyprint"><ul class="ui-listview">
- <li class="li-has-toggle">
- <label>
- Toggle 1
- <div class="ui-toggleswitch">
- <input type="checkbox" class="ui-switch-input">
- <div class="ui-switch-button"></div>
- </div>
- </label>
- </li>
+<pre class="prettyprint">
+<ul class="ui-listview">
+ <li class="li-has-toggle">
+ <label>
+ Toggle 1
+ <div class="ui-toggleswitch">
+ <input type="checkbox" class="ui-switch-input"/>
+ <div class="ui-switch-button"></div>
+ </div>
+ </label>
+ </li>
</ul></pre>
<div id="footer">
<h2><a id="how-to"></a>How to Create ViewSwitcher</h2>
<h3>HTML Examples</h3>
-<pre class="prettyprint"><div id="drawerPage" class="ui-page">
- <div id="moreoptionsDrawer" class="ui-drawer">
- <div id="pageIndicator" class="ui-page-indicator"></div>
- <div id="viewSwitcher" class="ui-view-switcher">
- <div class="ui-view custom-view">
- <button class="option-button">1</button>
- </div>
- <div class="ui-view custom-view ui-view-active">
- <button class="option-button">2</button>
- </div>
- <div class="ui-view custom-view">
- <button class="option-button">3</button>
- </div>
- <div class="ui-view custom-view">
- <button class="option-button">4</button>
- </div>
- <div class="ui-view custom-view">
- <button class="option-button">5</button>
- </div>
- </div>
- </div>
+<pre class="prettyprint">
+<div id="drawerPage" class="ui-page">
+ <div id="moreoptionsDrawer" class="ui-drawer">
+ <div id="pageIndicator" class="ui-page-indicator"></div>
+ <div id="viewSwitcher" class="ui-view-switcher">
+ <div class="ui-view custom-view">
+ <button class="option-button">1</button>
+ </div>
+ <div class="ui-view custom-view ui-view-active">
+ <button class="option-button">2</button>
+ </div>
+ <div class="ui-view custom-view">
+ <button class="option-button">3</button>
+ </div>
+ <div class="ui-view custom-view">
+ <button class="option-button">4</button>
+ </div>
+ <div class="ui-view custom-view">
+ <button class="option-button">5</button>
+ </div>
+ </div>
+ </div>
</div>
-
</pre>
<h3>Manual Constructor</h3>
<pre class="prettyprint">
-(function() {
- var viewSwitcherElement = page.querySelector("#viewSwitcher"),
- viewSwitcher = tau.widget.ViewSwitcher(viewSwitcherElement);
+(function()
+{
+ var viewSwitcherElement = page.querySelector("#viewSwitcher"),
+ viewSwitcher = tau.widget.ViewSwitcher(viewSwitcherElement);
})();
</pre>
<h3>Event example</h3>
<pre class="prettyprint">
-(function() {
- var viewSwitcherElement = page.querySelector("#viewSwitcher"),
- views = document.querySelectorAll(".ui-view"),
- elPageIndicator = document.querySelector("#pageIndicator");
+(function()
+{
+ var viewSwitcherElement = page.querySelector("#viewSwitcher"),
+ views = document.querySelectorAll(".ui-view"),
+ elPageIndicator = document.querySelector("#pageIndicator");
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, { numberOfPages: 5 }),
- viewSwitcherElement.addEventListener("viewchange", function(event) {
- var index = event.detail.index;
- if (index < 0 || index > views.length - 1) {
- return;
- }
- pageIndicator.setActive(index);
- }, false);
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5}),
+ viewSwitcherElement.addEventListener("viewchange", function(event)
+ {
+ var index = event.detail.index;
+ if (index < 0 || index > views.length - 1)
+ {
+ return;
+ }
+ pageIndicator.setActive(index);
+ }, false);
})();
</pre>
<h2><a id="methods-list"></a>Methods</h2>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-setActiveIndex">setActiveIndex</a> ( index ) </pre>
+ <pre class="intable prettyprint"><a href="#method-setActiveIndex">setActiveIndex</a>(index) </pre>
</td>
<td><p>Set the active view with index value</p></td>
</tr>
<tr>
<td>
- <pre class="intable prettyprint"><a href="#method-getActiveIndex">getActiveIndex</a> ( ) </pre>
+ <pre class="intable prettyprint"><a href="#method-getActiveIndex">getActiveIndex</a>() </pre>
</td>
<td><p>Get the active view index</p></td>
</tr>
<p>Set the active view with index value</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">setActiveIndex ( index ) </pre>
+ <pre class="signature prettyprint">setActiveIndex(index) </pre>
</div>
<div class="description">
<p>Get the active view index</p>
</div>
<div class="synopsis">
- <pre class="signature prettyprint">getActiveIndex ( ) </pre>
+ <pre class="signature prettyprint">getActiveIndex() </pre>
</div>
<div class="description">
</pre></li>
<li>Insert a virtual list HTML and JSON (<span style="font-family: Courier New,Courier,monospace">virtuallist-db-demo.js</span>) code:
-<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><script type="text/javascript" src="virtuallist-db-demo.js"></script>
+<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
+<script type="text/javascript" src="virtuallist-db-demo.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="../../lib/tau/js/virtuallist.js"></script></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JSON DATA example in virtuallist-db-demo.js */
var JSON_DATA =
/* Get HTML element reference */
var elList = document.getElementById("vlist"),
/* All config options can be found in virtual list reference */
- vlist = tau.widget.VirtualListview(elList, {
+ vlist = tau.widget.VirtualListview(elList,
+ {
dataLength: JSON_DATA.length,
bufferSize: 40
});
/* Update list items */
-vlist.setListItemUpdater(function(elListItem, newIndex) {
+vlist.setListItemUpdater(function(elListItem, newIndex)
+{
var data = JSON_DATA[newIndex];
elListItem.innerHTML = '<span class="ui-li-text-main">' + data.NAME + '</span>';
});
<li>When you no longer need the component, destroy it using the <span style="font-family: Courier New,Courier,monospace">destroy()</span> method:</p>
<pre class="prettyprint">
-page.addEventListener("pagehide", function() {
+page.addEventListener("pagehide", function()
+{
vlist.destroy();
});
</pre></li>
</ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> navigator.webkitGetUserMedia({video:true,audio:true}, gotStream, noStream);
-
- // For audio recording, use the API as following:
- // navigator.webkitGetUserMedia({video:false,audio:true}, gotStream, noStream);
-
- // WARNING :
- // Audio recording is not supported in initial target platform verison 2.2.1.
- // Please include following checking and guideline for end user.
- // if (tizen.systeminfo.getCapabilities().platformVersion === "2.2.1") {
- // // Inform the user to upgrade his/her system OS to properly use this application.
- // }
-
- function gotStream(stream) {
- navigator.tizCamera.createCameraControl(stream, gotCamera, noCamera);
- }
-
- function noStream() {
- }
-
- function gotCamera(cam) {//CameraControl
- camera = cam;
- }
-
- function noCamera() {
- }
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+navigator.webkitGetUserMedia({video:true,audio:true}, gotStream, noStream);
+
+/*
+ For audio recording, use the API as following:
+ navigator.webkitGetUserMedia({video:false,audio:true}, gotStream, noStream);
+
+ WARNING :
+ Audio recording is not supported in initial target platform version 2.2.1
+ Include the following check and guideline for the end user:
+ if (tizen.systeminfo.getCapabilities().platformVersion === "2.2.1")
+ {
+ <Inform the user to upgrade his/her system OS to properly use this application>
+ }
+*/
+
+function gotStream(stream)
+{
+ navigator.tizCamera.createCameraControl(stream, gotCamera, noCamera);
+}
+
+function noStream() {}
+
+function gotCamera(cam)
+{
+ /* CameraControl */
+ camera = cam;
+}
+
+function noCamera() {}
</pre>
</div>
</dd>