From aacd6c3fa1168160f95e585c1202ec9b6d7bb262 Mon Sep 17 00:00:00 2001 From: Editor Lionbridge Date: Thu, 3 Nov 2016 19:10:10 +0200 Subject: [PATCH] [LB] Web AR code snippet style update - Fixed the code examples to follow the same style as the guides - Mainly fixed the comment style to /* ... */, added and removed incorrect spaces, and modified line breaks and indentation Change-Id: Ie76ebb52942c024194bc53187e93d7e98d89e6ad --- .../html/device_api/mobile/tizen/account.html | 282 +- .../html/device_api/mobile/tizen/alarm.html | 163 +- .../html/device_api/mobile/tizen/application.html | 781 +++--- .../html/device_api/mobile/tizen/archive.html | 233 +- .../html/device_api/mobile/tizen/badge.html | 101 +- .../html/device_api/mobile/tizen/bluetooth.html | 2790 +++++++++--------- .../html/device_api/mobile/tizen/bookmark.html | 90 +- .../html/device_api/mobile/tizen/calendar.html | 1513 +++++----- .../html/device_api/mobile/tizen/callhistory.html | 242 +- .../html/device_api/mobile/tizen/contact.html | 2880 +++++++++++-------- .../html/device_api/mobile/tizen/content.html | 1261 +++++---- .../device_api/mobile/tizen/cordova/console.html | 72 +- .../device_api/mobile/tizen/cordova/cordova.html | 2 +- .../mobile/tizen/cordova/device-motion.html | 92 +- .../device_api/mobile/tizen/cordova/device.html | 62 +- .../device_api/mobile/tizen/cordova/dialogs.html | 56 +- .../device_api/mobile/tizen/cordova/events.html | 223 +- .../html/device_api/mobile/tizen/cordova/file.html | 609 ++-- .../mobile/tizen/cordova/filetransfer.html | 245 +- .../mobile/tizen/cordova/globalization.html | 382 +-- .../device_api/mobile/tizen/cordova/media.html | 396 +-- .../mobile/tizen/cordova/networkInformation.html | 96 +- .../html/device_api/mobile/tizen/datacontrol.html | 409 +-- .../html/device_api/mobile/tizen/datasync.html | 119 +- .../html/device_api/mobile/tizen/download.html | 190 +- .../html/device_api/mobile/tizen/exif.html | 184 +- .../html/device_api/mobile/tizen/feedback.html | 52 +- .../html/device_api/mobile/tizen/filesystem.html | 863 +++--- .../html/device_api/mobile/tizen/fmradio.html | 209 +- .../mobile/tizen/humanactivitymonitor.html | 238 +- .../html/device_api/mobile/tizen/inputdevice.html | 107 +- .../html/device_api/mobile/tizen/keymanager.html | 211 +- .../device_api/mobile/tizen/mediacontroller.html | 516 ++-- .../html/device_api/mobile/tizen/mediakey.html | 27 +- .../html/device_api/mobile/tizen/messageport.html | 124 +- .../html/device_api/mobile/tizen/messaging.html | 943 ++++--- .../mobile/tizen/networkbearerselection.html | 42 +- .../html/device_api/mobile/tizen/nfc.html | 1340 +++++---- .../html/device_api/mobile/tizen/notification.html | 355 +-- .../html/device_api/mobile/tizen/package.html | 159 +- .../html/device_api/mobile/tizen/power.html | 75 +- .../html/device_api/mobile/tizen/preference.html | 108 +- .../html/device_api/mobile/tizen/push.html | 228 +- .../html/device_api/mobile/tizen/se.html | 378 ++- .../html/device_api/mobile/tizen/sensor.html | 504 ++-- .../html/device_api/mobile/tizen/sound.html | 79 +- .../html/device_api/mobile/tizen/systeminfo.html | 259 +- .../device_api/mobile/tizen/systemsetting.html | 90 +- .../html/device_api/mobile/tizen/time.html | 816 +++--- .../html/device_api/mobile/tizen/tizen.html | 292 +- .../html/device_api/mobile/tizen/websetting.html | 24 +- .../device_api/mobile/tizen/widgetservice.html | 413 +-- .../html/device_api/tv/tizen/alarm.html | 163 +- .../html/device_api/tv/tizen/application.html | 781 +++--- .../html/device_api/tv/tizen/archive.html | 233 +- .../html/device_api/tv/tizen/content.html | 1261 +++++---- .../html/device_api/tv/tizen/cordova/console.html | 72 +- .../html/device_api/tv/tizen/cordova/cordova.html | 2 +- .../device_api/tv/tizen/cordova/device-motion.html | 92 +- .../html/device_api/tv/tizen/cordova/device.html | 62 +- .../html/device_api/tv/tizen/cordova/dialogs.html | 56 +- .../html/device_api/tv/tizen/cordova/events.html | 223 +- .../html/device_api/tv/tizen/cordova/file.html | 609 ++-- .../device_api/tv/tizen/cordova/filetransfer.html | 245 +- .../device_api/tv/tizen/cordova/globalization.html | 382 +-- .../html/device_api/tv/tizen/cordova/media.html | 396 +-- .../tv/tizen/cordova/networkInformation.html | 96 +- .../html/device_api/tv/tizen/datacontrol.html | 410 +-- .../html/device_api/tv/tizen/download.html | 190 +- .../html/device_api/tv/tizen/exif.html | 184 +- .../html/device_api/tv/tizen/filesystem.html | 863 +++--- .../html/device_api/tv/tizen/keymanager.html | 211 +- .../html/device_api/tv/tizen/messageport.html | 124 +- .../html/device_api/tv/tizen/package.html | 147 +- .../html/device_api/tv/tizen/systeminfo.html | 265 +- .../html/device_api/tv/tizen/time.html | 224 +- .../html/device_api/tv/tizen/tizen.html | 183 +- .../html/device_api/tv/tizen/tvaudiocontrol.html | 222 +- .../html/device_api/tv/tizen/tvchannel.html | 553 ++-- .../html/device_api/tv/tizen/tvdisplaycontrol.html | 87 +- .../html/device_api/tv/tizen/tvinfo.html | 22 +- .../html/device_api/tv/tizen/tvinputdevice.html | 107 +- .../html/device_api/tv/tizen/tvwindow.html | 281 +- .../html/device_api/tv/tizen/websetting.html | 24 +- .../html/device_api/wearable/tizen/alarm.html | 163 +- .../device_api/wearable/tizen/application.html | 787 +++--- .../html/device_api/wearable/tizen/archive.html | 233 +- .../html/device_api/wearable/tizen/badge.html | 66 +- .../html/device_api/wearable/tizen/bluetooth.html | 2961 +++++++++++--------- .../html/device_api/wearable/tizen/content.html | 1261 +++++---- .../device_api/wearable/tizen/cordova/console.html | 72 +- .../device_api/wearable/tizen/cordova/cordova.html | 2 +- .../wearable/tizen/cordova/device-motion.html | 92 +- .../device_api/wearable/tizen/cordova/device.html | 62 +- .../device_api/wearable/tizen/cordova/dialogs.html | 56 +- .../device_api/wearable/tizen/cordova/events.html | 223 +- .../device_api/wearable/tizen/cordova/file.html | 609 ++-- .../wearable/tizen/cordova/filetransfer.html | 245 +- .../wearable/tizen/cordova/globalization.html | 382 +-- .../device_api/wearable/tizen/cordova/media.html | 396 +-- .../wearable/tizen/cordova/networkInformation.html | 96 +- .../device_api/wearable/tizen/datacontrol.html | 410 +-- .../html/device_api/wearable/tizen/download.html | 190 +- .../html/device_api/wearable/tizen/exif.html | 184 +- .../html/device_api/wearable/tizen/feedback.html | 52 +- .../html/device_api/wearable/tizen/filesystem.html | 863 +++--- .../wearable/tizen/humanactivitymonitor.html | 238 +- .../device_api/wearable/tizen/inputdevice.html | 107 +- .../html/device_api/wearable/tizen/keymanager.html | 211 +- .../device_api/wearable/tizen/mediacontroller.html | 516 ++-- .../html/device_api/wearable/tizen/mediakey.html | 27 +- .../device_api/wearable/tizen/messageport.html | 124 +- .../html/device_api/wearable/tizen/nfc.html | 636 +++-- .../device_api/wearable/tizen/notification.html | 316 ++- .../html/device_api/wearable/tizen/package.html | 159 +- .../html/device_api/wearable/tizen/power.html | 75 +- .../html/device_api/wearable/tizen/preference.html | 108 +- .../html/device_api/wearable/tizen/push.html | 228 +- .../html/device_api/wearable/tizen/se.html | 378 ++- .../html/device_api/wearable/tizen/sensor.html | 504 ++-- .../html/device_api/wearable/tizen/sound.html | 79 +- .../html/device_api/wearable/tizen/systeminfo.html | 259 +- .../device_api/wearable/tizen/systemsetting.html | 90 +- .../html/device_api/wearable/tizen/time.html | 224 +- .../html/device_api/wearable/tizen/tizen.html | 183 +- .../device_api/wearable/tizen/widgetservice.html | 413 +-- .../html/ui_fw_api/Animation/animation.htm | 16 +- .../html/ui_fw_api/Base/popup.htm | 15 +- .../html/ui_fw_api/Gesture_Events/drag.htm | 54 +- .../html/ui_fw_api/Gesture_Events/gesture.htm | 10 +- .../html/ui_fw_api/Gesture_Events/swipe.htm | 34 +- .../html/ui_fw_api/Globalization/globalization.htm | 20 +- .../deprecated/mobile_Checkboxradio.htm | 25 +- .../deprecated/mobile_Collapsible.htm | 12 +- .../deprecated/mobile_FastScroll.htm | 16 +- .../deprecated/mobile_Gallery.htm | 56 +- .../deprecated/mobile_MultimediaView.htm | 4 +- .../deprecated/mobile_Notification.htm | 78 +- .../deprecated/mobile_ProgressBar.htm | 16 +- .../deprecated/mobile_ScrollHandler.htm | 4 +- .../deprecated/mobile_SearchBar.htm | 22 +- .../deprecated/mobile_SelectMenu.htm | 8 +- .../deprecated/mobile_Swipe.htm | 18 +- .../deprecated/mobile_TabBar.htm | 4 +- .../deprecated/mobile_Tokentextarea.htm | 64 +- .../Mobile_UIComponents/mobile_Button.htm | 28 +- .../Mobile_UIComponents/mobile_Checkbox.htm | 25 +- .../Mobile_UIComponents/mobile_ColoredListview.htm | 2 +- .../Mobile_UIComponents/mobile_Drawer.htm | 12 +- .../Mobile_UIComponents/mobile_DropdownMenu.htm | 128 +- .../Mobile_UIComponents/mobile_Expandable.htm | 8 +- .../Mobile_UIComponents/mobile_GridView.htm | 32 +- .../Mobile_UIComponents/mobile_Navigation.htm | 76 +- .../Mobile_UIComponents/mobile_PageIndicator.htm | 27 +- .../Mobile_UIComponents/mobile_PanelChanger.htm | 6 +- .../ui_fw_api/Mobile_UIComponents/mobile_Popup.htm | 14 +- .../Mobile_UIComponents/mobile_Progress.htm | 28 +- .../ui_fw_api/Mobile_UIComponents/mobile_Radio.htm | 29 +- .../Mobile_UIComponents/mobile_SearchInput.htm | 12 +- .../Mobile_UIComponents/mobile_SectionChanger.htm | 12 +- .../Mobile_UIComponents/mobile_Slider.htm | 40 +- .../ui_fw_api/Mobile_UIComponents/mobile_Tabs.htm | 19 +- .../Mobile_UIComponents/mobile_TextEnveloper.htm | 61 +- .../Mobile_UIComponents/mobile_TextInput.htm | 16 +- .../Mobile_UIComponents/mobile_ToggleSwitch.htm | 20 +- .../Wearable_UIComponents/wearable_button.htm | 12 +- .../Wearable_UIComponents/wearable_checkbox.htm | 42 +- .../wearable_circleprogressbar.htm | 147 +- .../wearable_circularindexscrollbar.htm | 211 +- .../Wearable_UIComponents/wearable_drawer.htm | 292 +- .../wearable_indexscrollbar.htm | 19 +- .../Wearable_UIComponents/wearable_marquee.htm | 57 +- .../wearable_pageindicator.htm | 159 +- .../Wearable_UIComponents/wearable_popup.htm | 58 +- .../Wearable_UIComponents/wearable_processing.htm | 17 +- .../wearable_sectionchanger.htm | 28 +- .../Wearable_UIComponents/wearable_selector.htm | 79 +- .../Wearable_UIComponents/wearable_slider.htm | 17 +- .../wearable_snaplistview.htm | 20 +- .../Wearable_UIComponents/wearable_swipelist.htm | 12 +- .../wearable_toggleswitch.htm | 46 +- .../wearable_viewSwitcher.htm | 86 +- .../Wearable_UIComponents/wearable_virtuallist.htm | 12 +- .../html/w3c_api/camera_w.html | 55 +- 184 files changed, 26350 insertions(+), 21065 deletions(-) diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/account.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/account.html index 7a2b684..7652f5b 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/account.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/account.html @@ -432,22 +432,26 @@ If the specified key already exists, the corresponding value is overwritten with
-

Code example:

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

Code example:

+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);
+
@@ -501,18 +505,22 @@ Returns null if the given key is not found.
-

Code example:

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

Code example:

+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);
+
@@ -569,24 +577,31 @@ Returns an empty array if there is no extended data.
-

Code example:

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

Code example:

+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);
+
@@ -687,12 +702,13 @@ You should implement the appcontrol for the account provider.
For more detail
-

Code example:

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

Code example:

+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);
- 
+tizen.account.add(account); +
@@ -747,16 +763,20 @@ This method can be used by an account provider application.
-

Code example:

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

Code example:

+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);
+
@@ -810,17 +830,21 @@ This method can be used only an account provider application.
-

Code example:

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

Code example:

+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);
+
@@ -870,8 +894,9 @@ This method can be used only an account provider application.
-

Code example:

 var account = tizen.account.getAccount(1);
- 
+

Code example:

+var account = tizen.account.getAccount(1);
+
@@ -929,13 +954,15 @@ If you want to get all accounts, omit the applicationId argument.
-

Code example:

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

Code example:

+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);
+});
+
@@ -990,12 +1017,14 @@ You can register your application as an account provider by writing account rela
-

Code example:

 var appId = tizen.application.getCurrentApplication().appInfo.id;
- var provider = tizen.account.getProvider(appId);
- if (!provider) {
-     console.log('current application is not account provider.');
- }
- 
+

Code example:

+var appId = tizen.application.getCurrentApplication().appInfo.id;
+var provider = tizen.account.getProvider(appId);
+if (!provider)
+{
+   console.log('current application is not account provider.');
+}
+
@@ -1053,13 +1082,18 @@ If you want to get all the providers, omit the capability argument.
-

Code example:

 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");
- 
+

Code example:

+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");
+
@@ -1112,18 +1146,23 @@ If you want to get all the providers, omit the capability argument.
-

Code example:

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

Code example:

+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 */
+   }
+});
+
@@ -1169,19 +1208,24 @@ If you want to get all the providers, omit the capability argument.
-

Code example:

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

Code example:

+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);
+
diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/alarm.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/alarm.html index 4c1ebd2..ba0349e 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/alarm.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/alarm.html @@ -278,12 +278,13 @@ For more information about the application control, see -

Code example:

 // 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);
- 
+

Code example:

+/* 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);
+
@@ -340,18 +341,23 @@ If an alarm goes off, it will be removed from the storage automatically.
-

Code example:

 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.");
-   }
- }
- 
+

Code example:

+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.");
+   }
+}
+
@@ -393,9 +399,10 @@ Because each application has its own alarm storage, this method removes alarms o
-

Code example:

 tizen.alarm.removeAll();
- console.log("remove all registered alarms in the storage.");
- 
+

Code example:

+tizen.alarm.removeAll();
+console.log("remove all registered alarms in the storage.");
+
@@ -440,18 +447,19 @@ Because each application has its own alarm storage, this method removes alarms o
-

Code example:

 // Sets an alarm
- var date = new Date();
- date.setHours(date.getHours()+1);
- var abs_alarm = new tizen.AlarmAbsolute(date);
+

Code example:

+/* 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());
- 
+/* Gets an alarm */ +var alarm = tizen.alarm.get(abs_alarm.id); +console.log("The alarm will trigger at " + alarm.getNextScheduledDate()); +
@@ -484,9 +492,10 @@ Alarms that have already been triggered are removed automatically from the stora
-

Code example:

 var alarms = tizen.alarm.getAll();
- console.log(alarms.length + " alarms present in the storage.");
- 
+

Code example:

+var alarms = tizen.alarm.getAll();
+console.log(alarms.length + " alarms present in the storage.");
+
@@ -548,17 +557,18 @@ It is guaranteed that this alarm will be fired after at least delay sec If period is provided, it will be adjusted by the operating system, however this value will not be lower than 600 seconds.

-

Code example:

 // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+

Code example:

+/* 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);
- 
+/* 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); +
@@ -630,16 +640,17 @@ If the alarm has expired, this method returns null.
-

Code example:

 // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+

Code example:

+/* 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);
- 
+var sec = alarm.getRemainingSeconds(); +console.log("remaining time is " + sec); +
@@ -674,22 +685,23 @@ If a period is provided, the alarm keeps triggering for the given inter

-

Code example:

 // Gets the current application ID.
- var appId = tizen.application.getCurrentApplication().appInfo.id;
+

Code example:

+/* 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);
- 
+/* 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); +
@@ -786,17 +798,18 @@ If the alarm has expired, this method returns null. The returned date
-

Code example:

 // 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);
- 
+

Code example:

+/* 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);
+
diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/application.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/application.html index a180f02..d2f5661 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/application.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/application.html @@ -391,9 +391,10 @@ The tizen.application object allows access to the Application API's fun
-

Code example:

 var app = tizen.application.getCurrentApplication();
- console.log("Current application's app id is " + app.appInfo.id);
- 
+

Code example:

+var app = tizen.application.getCurrentApplication();
+console.log("Current application's app id is " + app.appInfo.id);
+
@@ -461,23 +462,28 @@ UnknownError - If any other error occurs.
-

Code example:

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

Code example:

+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);
+
@@ -542,13 +548,15 @@ UnknownError - If any other error occurs.
-

Code example:

 function onsuccess() {
-     console.log("The application has launched successfully");
- }
+

Code example:

+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);
- 
+/* Let's assume that application "targetApp0.main" has been installed */ +tizen.application.launch("targetApp0.main", onsuccess); +
@@ -642,34 +650,33 @@ UnknownError: If any other error occurs.
-

Code example:

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

Code example:

+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);
+
@@ -724,42 +731,41 @@ UnknownError - If any other error occurs.
-

Code example:

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

Code example:

+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);
+
@@ -806,13 +812,15 @@ UnknownError - If an unknown error occurs.
-

Code example:

 function onRunningAppsContext(contexts) {
-     for (var i = 0; i < contexts.length; i++)
-         console.log("ID : " + contexts[i].id);
- }
+

Code example:

+function onRunningAppsContext(contexts)
+{
+   for (var i = 0; i < contexts.length; i++)
+      console.log("ID: " + contexts[i].id);
+}
 
- tizen.application.getAppsContext(onRunningAppsContext);
- 
+tizen.application.getAppsContext(onRunningAppsContext); +
@@ -856,9 +864,10 @@ The list of running applications and their application IDs is obtained with
-

Code example:

 var appContext = tizen.application.getAppContext(null);
- console.log("Application context retrieved for app " + appContext.appId);
- 
+

Code example:

+var appContext = tizen.application.getAppContext(null);
+console.log("Application context retrieved for app " + appContext.appId);
+
@@ -905,13 +914,15 @@ UnknownError - If an unknown error occurs.
-

Code example:

 function onListInstalledApps(applications) {
-     for (var i = 0; i < applications.length; i++)
-         console.log("ID : " + applications[i].id);
- }
+

Code example:

+function onListInstalledApps(applications)
+{
+   for (var i = 0; i < applications.length; i++)
+      console.log("ID: " + applications[i].id);
+}
 
- tizen.application.getAppsInfo(onListInstalledApps);
- 
+tizen.application.getAppsInfo(onListInstalledApps); +
@@ -959,9 +970,10 @@ The list of installed applications and their application IDs is obtained with
-

Code example:

 var appInfo = tizen.application.getAppInfo(null);
- console.log("Current application name : " + appInfo.name);
- 
+

Code example:

+var appInfo = tizen.application.getAppInfo(null);
+console.log("Current application name: " + appInfo.name);
+
@@ -1042,13 +1054,15 @@ The certificate types are listed below:
-

Code example:

 var appCerts = tizen.application.getAppCerts(null);
+

Code example:

+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);
- }
- 
+for (var i = 0; i < appCerts.length; i++) +{ +   console.log("#" + i + " type:" + appCerts[i].type); +   console.log("#" + i + " value:" + appCerts[i].value); +} +
@@ -1096,9 +1110,10 @@ If the ID is set to null or not set at all, it returns the shared dir
-

Code example:

 var sharedDir = tizen.application.getAppSharedURI(null);
- console.log("shared directory : " + sharedDir);
- 
+

Code example:

+var sharedDir = tizen.application.getAppSharedURI(null);
+console.log("shared directory: " + sharedDir);
+
@@ -1157,10 +1172,10 @@ an empty array is returned
-

Code example:

 var metaDataArray = tizen.application.getAppMetaData(null);
- console.log("size of metadata : " + metaDataArray.length);
-
- 
+

Code example:

+var metaDataArray = tizen.application.getAppMetaData(null);
+console.log("size of metadata: " + metaDataArray.length);
+
@@ -1226,19 +1241,24 @@ with the corresponding listener identifier.
-

Code example:

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

Code example:

+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);
+
@@ -1280,20 +1300,25 @@ applications on a device.
-

Code example:

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

Code example:

+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);
+
@@ -1378,10 +1403,11 @@ the basic operations (such as exit or hide) for the current application.
-

Code example:

 var app = tizen.application.getCurrentApplication();
+

Code example:

+var app = tizen.application.getCurrentApplication();
 
- app.exit();
- 
+app.exit(); +
@@ -1405,10 +1431,11 @@ the basic operations (such as exit or hide) for the current application.
-

Code example:

 var app = tizen.application.getCurrentApplication();
+

Code example:

+var app = tizen.application.getCurrentApplication();
 
- app.hide();
- 
+app.hide(); +
@@ -1448,12 +1475,14 @@ appropriately when it is launched.
-

Code example:

 var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
+

Code example:

+var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
 
- if (reqAppControl) {
-     console.log("Requester AppID : " + reqAppControl.callerAppId);
- }
- 
+if (reqAppControl) +{ +   console.log("Requester AppID: " + reqAppControl.callerAppId); +} +
@@ -1504,28 +1533,35 @@ System events do not require an application identifier to be specified. Therefor
-

Code example:

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

Code example:

+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);
+
@@ -1558,31 +1594,39 @@ System events do not require an application identifier to be specified. Therefor
-

Code example:

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

Code example:

+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);
+
@@ -1629,14 +1673,16 @@ An application can listen to events from other applications. However, it can onl
-

Code example:

 var myCustomData = {
-   foo: 'bar'
- };
+

Code example:

+var myCustomData = 
+{
+   foo: 'bar'
+};
 
- var app = tizen.application.getCurrentApplication();
+var app = tizen.application.getCurrentApplication();
 
- app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
- 
+app.broadcastEvent({"name": "custom_user_event"}, myCustomData); +
@@ -1683,14 +1729,16 @@ An application can listen to events from other applications. However, it can onl
-

Code example:

 var myTrustedCustomData = {
-   foo: 'bar'
- };
+

Code example:

+var myTrustedCustomData = 
+{
+   foo: 'bar'
+};
 
- var app = tizen.application.getCurrentApplication();
+var app = tizen.application.getCurrentApplication();
 
- app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
- 
+app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData); +
@@ -1898,8 +1946,9 @@ between applications through the ApplicationControl interface. 2.0

-

Code example:

 var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
- 
+

Code example:

+var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
+

Constructors

@@ -1962,15 +2011,11 @@ and launches the selected application. 2.0

-

Code example:

 var appControl =
-       new tizen.ApplicationControl(
-                  "http://tizen.org/appcontrol/operation/view",
-                  null,
-                  "image/jpeg",
-                  null,
-                  [new tizen.ApplicationControlData("images",
-                                                    [imagedata1, imagedata2])] );
- 
+

Code example:

+var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
+                                              null, "image/jpeg", null,
+                                              [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+

Constructors

@@ -2128,17 +2173,20 @@ It contains the information that the calling application passed to launchApp
-

Code example:

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

Code example:

+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]);
+   }
+}
+
@@ -2168,16 +2216,19 @@ to perform the requested action.
-

Code example:

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

Code example:

+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();
+   }
+}
+
@@ -2309,13 +2360,15 @@ This callback interface specifies a success method with an array of
-

Code example:

 function onListInstalledApps(applications) {
-     for (var i = 0; i < applications.length; i++)
-         console.log("ID : " + applications[i].id);
- }
+

Code example:

+function onListInstalledApps(applications)
+{
+   for (var i = 0; i < applications.length; i++)
+      console.log("ID: " + applications[i].id);
+}
 
- tizen.application.getAppsInfo(onListInstalledApps);
- 
+tizen.application.getAppsInfo(onListInstalledApps); +
@@ -2369,43 +2422,42 @@ It is used in ApplicationManager.findAppControl().
-

Code example:

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

Code example:

+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);
+
@@ -2484,35 +2536,34 @@ This callback interface specifies two methods:
-

Code example:

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

Code example:

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

Methods

@@ -2581,19 +2632,24 @@ an application is installed, updated, or uninstalled.

-

Code example:

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

Code example:

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

Methods

@@ -2731,30 +2787,37 @@ Platform modules will be able to broadcast system events in a future Tizen relea
-

Code example:

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

Code example:

+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);
+
diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/archive.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/archive.html index 978173a..1eece8b 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/archive.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/archive.html @@ -457,16 +457,19 @@ In this mode, getEntries(), getEntryByName(), and extractA
-

Code example:

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

Code example:

+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);
+
@@ -499,13 +502,15 @@ In this mode, getEntries(), getEntryByName(), and extractA
-

Code example:

 function openSuccess(archive) {
-     operationId = archive.extractAll("downloads/extracted");
-     tizen.archive.abort(operationId);
- }
-
- tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
- 
+

Code example:

+function openSuccess(archive)
+{
+   operationId = archive.extractAll("downloads/extracted");
+   tizen.archive.abort(operationId);
+}
+
+tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
+
@@ -724,24 +729,29 @@ If the source file is big then the callback can also be called while the file is
-

Code example:

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

Code example:

+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);
+
@@ -835,24 +845,29 @@ UnknownError: In any other error case
-

Code example:

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

Code example:

+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);
+
@@ -921,23 +936,28 @@ UnknownError: In case of any error
-

Code example:

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

Code example:

+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);
+
@@ -1012,20 +1032,24 @@ UnknownError: In case of any other error
-

Code example:

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

Code example:

+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);
+
@@ -1229,24 +1253,29 @@ UnknownError: In case of any other error
-

Code example:

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

Code example:

+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);
+
diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/badge.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/badge.html index 1ce080f..f4873f1 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/badge.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/badge.html @@ -115,8 +115,9 @@ There is a tizen.badge object that allows accessing the functionality of the Bad 2.3

-

Code example:

   console.log("Maximum length of a badge number is " + tizen.badge.maxBadgeCount);
- 
+

Code example:

+console.log("Maximum length of a badge number is " + tizen.badge.maxBadgeCount);
+
@@ -173,10 +174,11 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
-

Code example:

 var app = tizen.application.getCurrentApplication();
- var appid = app.appInfo.id;
- tizen.badge.setBadgeCount(appid, 3);
- 
+

Code example:

+var app = tizen.application.getCurrentApplication();
+var appid = app.appInfo.id;
+tizen.badge.setBadgeCount(appid, 3);
+
@@ -229,10 +231,11 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
-

Code example:

 var app = tizen.application.getCurrentApplication();
- var appid = app.appInfo.id;
- var count = tizen.badge.getBadgeCount(appid);
- 
+

Code example:

+var app = tizen.application.getCurrentApplication();
+var appid = app.appInfo.id;
+var count = tizen.badge.getBadgeCount(appid);
+
@@ -288,19 +291,22 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
-

Code example:

  // Let's assume that at least two applications are installed
+

Code example:

+/* 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);
- 
+tizen.application.getAppsInfo(onListInstalledApps); +
@@ -349,22 +355,25 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
-

Code example:

  // Let's assume that at least two applications are installed
+

Code example:

+/* 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);
- 
+tizen.application.getAppsInfo(onListInstalledApps); +
@@ -413,21 +422,25 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
-

Code example:

   // logs the number of badge changes:
-   function watcher(appId, count) {
-     console.log(appId + ' -> badge number updates: ' + count);
-   }
+

Code example:

+/* 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);
- 
+/* + Registers to be notified when the badge number changes for either + this or targetAppId application +*/ +tizen.badge.addChangeListener([appId, targetAppId], watcher); +
diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/bluetooth.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/bluetooth.html index 4e928fb..da71999 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/bluetooth.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/bluetooth.html @@ -507,9 +507,12 @@ The tizen.bluetooth object allows access to the Bluetooth API.
BluetoothLEServiceData(DOMString uuid, DOMString data);
-

Code example:

 // Creates a serviceData.
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- 
+

Code example:

+/* Creates a serviceData */
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+
+
+

Attributes

@@ -523,10 +526,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. 2.3.1

-

Code example:

 // Creates a serviceData.
- var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
- service.uuid = "f236-41a4";
- 
+

Code example:

+/* Creates a serviceData */
+var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+service.uuid = "f236-41a4";
+
  • @@ -538,10 +542,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. 2.3.1

    -

    Code example:

     // Creates a serviceData.
    - var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    - service.data = "0x1815";
    - 
    +

    Code example:

    +/* Creates a serviceData */
    +var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    +service.data = "0x1815";
    +
  • @@ -566,9 +571,10 @@ The tizen.bluetooth object allows access to the Bluetooth API.
    BluetoothLEManufacturerData(DOMString id, DOMString data);
    -

    Code example:

     // Creates a manufacturerData.
    - var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    - 
    +

    Code example:

    +/* Creates a manufacturerData */
    +var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    +
    @@ -584,10 +590,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. 2.3.1

    -

    Code example:

     // Creates a manufacturerData.
    - var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    - manufacturer.id = "129";
    - 
    +

    Code example:

    +/* Creates a manufacturerData */
    +var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    +manufacturer.id = "129";
    +
  • @@ -599,10 +606,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. 2.3.1

    -

    Code example:

     // Creates a manufacturerData.
    - var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    - manufacturer.data = "0x0059"
    - 
    +

    Code example:

    +/* Creates a manufacturerData */
    +var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    +manufacturer.data = "0x0059"
    +
  • @@ -632,9 +640,13 @@ This dictionary is used as an input parameter of the BluetoothLEAdvertiseData co

    -

    Code example:

     var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    -                    appearance: 192, includeTxPowerLevel: false  }
    - 
    +

    Code example:

    +var advertData = 
    +{
    +   includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    +   appearance: 192, includeTxPowerLevel: false
    +}
    +
    @@ -663,10 +675,14 @@ This represents the data to be advertised as well as the scan response data for

    -

    Code example:

     var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    -                    appearance: 192, includeTxPowerLevel: false }
    - var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
    - 
    +

    Code example:

    +var advertData =
    +{
    +   includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    +   appearance: 192, includeTxPowerLevel: false
    +}
    +var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
    +
  • @@ -749,9 +769,10 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - advertise.includeTxPowerLevel = true;
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +advertise.includeTxPowerLevel = true;
    +
  • @@ -763,10 +784,11 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    - advertise.serviceData = service;
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    +advertise.serviceData = service;
    +
  • @@ -778,10 +800,11 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    - advertise.manufacturerData = manufacture;
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    +advertise.manufacturerData = manufacture;
    +
  • @@ -817,8 +840,9 @@ If attribute is set to null, The default value is set to a false. 1.0

    -

    Code example:

     console.log(tizen.bluetooth.deviceMajor);
    - 
    +

    Code example:

    +console.log(tizen.bluetooth.deviceMajor);
    +
  • @@ -831,8 +855,9 @@ If attribute is set to null, The default value is set to a false. 1.0

    -

    Code example:

     console.log(tizen.bluetooth.deviceMinor);
    - 
    +

    Code example:

    +console.log(tizen.bluetooth.deviceMinor);
    +
  • @@ -845,8 +870,9 @@ If attribute is set to null, The default value is set to a false. 1.0

    -

    Code example:

     console.log(tizen.bluetooth.deviceService);
    - 
    +

    Code example:

    +console.log(tizen.bluetooth.deviceService);
    +
  • @@ -896,12 +922,16 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     try {
    -     var adapter = tizen.bluetooth.getDefaultAdapter() ;
    - } catch (err) {
    -     console.log (err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var adapter = tizen.bluetooth.getDefaultAdapter();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -952,12 +982,16 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     try {
    -     var adapter = tizen.bluetooth.getLEAdapter();
    - } catch (err) {
    -     console.log(err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var adapter = tizen.bluetooth.getLEAdapter();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1048,10 +1082,11 @@ Registering a service in the device service database 1.0

    -

    Code example:

     // Access adapter name
    - var adapter = tizen.bluetooth.getDefaultAdapter();
    - console.log ("Bluetooth adapter name: " + adapter.name);
    - 
    +

    Code example:

    +/* Access adapter name */
    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +console.log("Bluetooth adapter name: " + adapter.name);
    +
  • @@ -1064,9 +1099,10 @@ Registering a service in the device service database
  • 1.0

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - console.log("Bluetooth device address: " + adapter.address);
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +console.log("Bluetooth device address: " + adapter.address);
    +
  • @@ -1090,9 +1126,10 @@ This attribute holds one of the following 2 values: 1.0

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));
    +
  • @@ -1105,10 +1142,11 @@ This attribute holds one of the following 2 values: 1.0

    -

    Code example:

     // Queries the current visible state
    - var adapter = tizen.bluetooth.getDefaultAdapter();
    - console.log ("Bluetooth Visibility: " + (adapter.visible ? "On" : "Off"));
    - 
    +

    Code example:

    +/* Queries the current visible state */
    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +console.log("Bluetooth Visibility: " + (adapter.visible ? "On" : "Off"));
    +
  • @@ -1191,25 +1229,30 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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");
    +}
    +
    @@ -1288,41 +1331,51 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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();
    +}
    +
    @@ -1363,21 +1416,26 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1406,24 +1464,29 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1504,41 +1567,50 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1606,56 +1678,67 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1732,27 +1815,32 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1828,20 +1916,23 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1915,19 +2006,22 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2001,25 +2095,30 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -2105,52 +2204,58 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +      });
    +   }
    +}
    +
    @@ -2193,16 +2298,20 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -2306,13 +2415,13 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("[Found device] address: " + device.address);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("[Found device] address: " + device.address);
    +});
    +
    @@ -2353,16 +2462,17 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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();
    +   }
    +});
    +
    @@ -2452,32 +2562,30 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2518,25 +2626,27 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +
    @@ -2557,20 +2667,21 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

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

    Code example:

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

    Attributes

    @@ -2585,10 +2696,10 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

     var service = device.getService(device.uuids[0]);
    - console.log("Service UUID " + service.uuid);
    -
    - 
    +

    Code example:

    +var service = device.getService(device.uuids[0]);
    +console.log("Service UUID " + service.uuid);
    +
  • @@ -2602,12 +2713,13 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

     var service = device.getService(device.uuids[0]);
    - for( var i = 0; i  service.services.length; ++i) {
    -   console.log("Subservices UUID " + service.services[i].uuid);
    - }
    -
    - 
    +

    Code example:

    +var service = device.getService(device.uuids[0]);
    +for (var i = 0; i  service.services.length; ++i)
    +{
    +   console.log("Subservices UUID " + service.services[i].uuid);
    +}
    +
  • @@ -2621,12 +2733,13 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

     var service = device.getService(device.uuids[0]);
    - for( var i = 0; i  service.characteristics.length; ++i) {
    -   console.log("Subservices UUID " + service.characteristics[i].isWritable);
    - }
    -
    - 
    +

    Code example:

    +var service = device.getService(device.uuids[0]);
    +for (var i = 0; i  service.characteristics.length; ++i)
    +{
    +   console.log("Subservices UUID " + service.characteristics[i].isWritable);
    +}
    +
  • @@ -2822,34 +2935,40 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -2919,37 +3038,44 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -2998,36 +3124,40 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -3140,35 +3270,41 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -3238,38 +3374,45 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -3519,11 +3662,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 1.0

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Device Name: " + device.name);
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Device Name: " + device.name);
    +});
    +
  • @@ -3536,11 +3681,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 1.0

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Device Address: " + device.address);
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Device Address: " + device.address);
    +});
    +
  • @@ -3553,11 +3700,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 1.0

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Device Major Class: " + device.deviceClass.major);
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Device Major Class: " + device.deviceClass.major);
    +});
    +
  • @@ -3570,11 +3719,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 1.0

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
    +});
    +
  • @@ -3587,11 +3738,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 1.0

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
    +});
    +
  • @@ -3604,11 +3757,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 1.0

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
    +});
    +
  • @@ -3622,27 +3777,31 @@ A BluetoothDevice object can be retrieved using one of the following AP 1.0

    -

    Code example:

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

    Code example:

    +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);
    +      });
    +   }
    +});
    +
  • @@ -3721,57 +3880,68 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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); });
    +
    @@ -3832,13 +4002,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.address);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.address);
    +});
    +
  • @@ -3851,13 +4021,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.name);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.name);
    +});
    +
  • @@ -3870,13 +4040,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.txpowerlevel);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.txpowerlevel);
    +});
    +
  • @@ -3889,13 +4059,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.appearance);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.appearance);
    +});
    +
  • @@ -3909,18 +4079,19 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -3934,18 +4105,19 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -3959,18 +4131,19 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -3983,15 +4156,15 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -4009,14 +4182,14 @@ The signal strength depends on distance (between the device and the beacon) and 3.0

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.name);
    -         console.log("RSSI: " + device.rssi);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.name);
    +   console.log("RSSI: " + device.rssi);
    +});
    +

    Output example:

     Found device: beacon
    @@ -4092,24 +4265,27 @@ Instead, use http://tizen.org/privilege/bluetooth.
     
  • -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -4175,29 +4351,35 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4253,26 +4435,31 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4305,26 +4492,31 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4361,30 +4553,37 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4410,32 +4609,39 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4595,46 +4801,55 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);});
    +
    @@ -4684,43 +4899,50 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);});
    +
    @@ -4825,25 +5047,31 @@ The BluetoothClassDeviceMajor interface contains the list of known valu 1.0

    -

    Code example:

     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");
    -
    - 
    +

    Code example:

    +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");
    +
  • @@ -4928,15 +5156,19 @@ Instead, use http://tizen.org/privilege/bluetooth.
  • -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -5210,49 +5442,54 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +      });
    +   }
    +}
    +
    @@ -5377,19 +5614,22 @@ For example, pulse oximeter is 4100 and blood pressure monitor is 4103.
    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
    +

    Code example:

    +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);
    - 
    +healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError); +
    @@ -5464,38 +5704,44 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -5637,46 +5883,60 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +}
    +
    @@ -5800,23 +6060,27 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -5876,23 +6140,27 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -5945,32 +6213,39 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -6012,35 +6287,42 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/bookmark.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/bookmark.html index 5c29f33..b860d2e 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/bookmark.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/bookmark.html @@ -191,13 +191,17 @@ In this case, the return will contain bookmarks under the root bookmark folder.
    -

    Code example:

     try {
    -  // Retrieves bookmarks from the root bookmark folder recursively.
    -  var allBookmarks = tizen.bookmark.get(null, true);
    - } catch (err) {
    -  console.log (err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   /* Retrieves bookmarks from the root bookmark folder recursively */
    +   var allBookmarks = tizen.bookmark.get(null, true);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -262,13 +266,17 @@ In this case, the bookmark is added under the root bookmark folder.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -323,13 +331,17 @@ In this case, all the bookmarks will be removed.
    -

    Code example:

     try {
    - // Removes all the bookmark folders and items.
    -  tizen.bookmark.remove();
    - } catch (err) {
    -  console.log (err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   /* Removes all the bookmark folders and items */
    +   tizen.bookmark.remove();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -356,13 +368,17 @@ In this case, all the bookmarks will be removed.
    BookmarkItem(DOMString title, DOMString url);
    -

    Code example:

     try {
    - // Creates a bookmark item.
    -  var tizen = new tizen.BookmarkItem("tizen", "https://www.tizen.org");
    - } catch (err) {
    -  console.log (err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   /* Creates a bookmark item */
    +   var tizen = new tizen.BookmarkItem("tizen", "https://www.tizen.org");
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -431,13 +447,17 @@ If the parent bookmark folder indicates the root bookmark folder, the value will
    BookmarkFolder(DOMString title);
    -

    Code example:

     try {
    - // creates a bookmark folder
    -  var folder = new tizen.BookmarkFolder("folder");
    - } catch (err) {
    -  console.log (err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   /* Creates a bookmark folder */
    +   var folder = new tizen.BookmarkFolder("folder");
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/calendar.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/calendar.html index 327ff22..7bece78 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/calendar.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/calendar.html @@ -673,45 +673,53 @@ UnknownError - if any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -775,38 +783,44 @@ If an item is added to the unified calendar, it will be saved in the default cal
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -865,38 +879,44 @@ If an item is added to the unified calendar, it will be saved in the default cal
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -954,21 +974,22 @@ will have its identifier (id attribute) set when the function returns.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1036,22 +1057,23 @@ The function will throw an exception if it failed to remove the specified calend
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1117,14 +1139,18 @@ The function will throw an exception if it failed to remove the specified calend
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1197,22 +1223,23 @@ This interface offers the following methods to manage events in a calendar:
    -

    Code example:

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

    Code example:

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

    Constructors

    @@ -1241,10 +1268,11 @@ This interface offers the following methods to manage events in a calendar: 1.0

    -

    Code example:

      // Gets the default calendar and show its name.
    -  var calendar = tizen.calendar.getDefaultCalendar("EVENT");
    -  console.log('The calendar name is ' + calendar.name);
    - 
    +

    Code example:

    +/* Gets the default calendar and shows its name */
    +var calendar = tizen.calendar.getDefaultCalendar("EVENT");
    +console.log('The calendar name is ' + calendar.name);
    +
  • @@ -1321,15 +1349,19 @@ This interface offers the following methods to manage events in a calendar:
  • -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1392,18 +1424,22 @@ To update an existing item, call the update() method instead. If you wi
    -

    Code example:

      // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -1477,26 +1513,32 @@ If you wish to update an existing item, call the update() method instea
    -

    Code example:

      // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -1560,27 +1602,30 @@ In case of recurring events, the default behavior is to update all their instanc
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1655,32 +1700,36 @@ UnknownError - if any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1741,26 +1790,29 @@ UnknownError - if any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1833,32 +1885,35 @@ UnknownError - if any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1944,27 +1999,30 @@ If no recurrence ID is given, the filter will match both the parent event and al
    -

    Code example:

      // Defines the error callback.
    -  function errorCallback(response) {
    -    console.log( 'The following error occurred: ' +  response.name);
    -  }
    +

    Code example:

    +/* 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);
    - 
    +calendar.find(eventSearchSuccessCallback, errorCallback, filter, sortingMode); +
    @@ -2028,24 +2086,29 @@ When executed, the implementation must immediately return a subscription identif
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2099,28 +2162,33 @@ If the watchId argument is valid and corresponds to a subscription alre
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2324,8 +2392,9 @@ The default value is an empty string. 1.0

    -

    Code example:

      event.description = 'Tizen Codefest';
    - 
    +

    Code example:

    +event.description = 'Tizen Codefest';
    +
  • @@ -2343,8 +2412,9 @@ The default value is an empty string. 1.0

    -

    Code example:

      event.summary = 'Launching the Tizen reference implementation';
    - 
    +

    Code example:

    +event.summary = 'Launching the Tizen reference implementation';
    +
  • @@ -2364,8 +2434,9 @@ The default value for this attribute is false. 1.0

    -

    Code example:

      event.isAllDay = true; // All-Day event
    - 
    +

    Code example:

    +event.isAllDay = true; /* All-day event */
    +
  • @@ -2391,9 +2462,10 @@ This attribute is precise to the second. Milliseconds are ignored. 1.0

    -

    Code example:

      // 2010-04-30 09:00
    -  event.startDate = new tizen.TZDate(2010, 3, 30, 9, 0);
    - 
    +

    Code example:

    +/* 2010-04-30 09:00 */
    +event.startDate = new tizen.TZDate(2010, 3, 30, 9, 0);
    +
  • @@ -2420,9 +2492,10 @@ This attribute is precise to the second. Milliseconds are ignored. 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 null 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.

    -

    Code example:

      // 1 hour meeting
    -  event.duration = new tizen.TimeDuration(1, "HOURS");
    - 
    +

    Code example:

    +/* 1 hour meeting */
    +event.duration = new tizen.TimeDuration(1, "HOURS");
    +
  • @@ -2440,8 +2513,9 @@ The default value for this attribute is an empty string. 1.0

    -

    Code example:

      event.location = 'Huesca';
    - 
    +

    Code example:

    +event.location = 'Huesca';
    +
  • @@ -2454,8 +2528,9 @@ The default value for this attribute is an empty string. 1.0

    -

    Code example:

      event.geolocation = new tizen.SimpleCoordinates(60.175, 24.934);
    - 
    +

    Code example:

    +event.geolocation = new tizen.SimpleCoordinates(60.175, 24.934);
    +
  • @@ -2473,8 +2548,9 @@ By default, this attribute is initialized to an empty string. 1.0

    -

    Code example:

      event.organizer = 'Mr. Jones';
    - 
    +

    Code example:

    +event.organizer = 'Mr. Jones';
    +
  • @@ -2507,8 +2583,9 @@ The default value for this attribute is NONE. 1.0

    -

    Code example:

      event.status = "TENTATIVE";
    - 
    +

    Code example:

    +event.status = "TENTATIVE";
    +
  • @@ -2537,8 +2614,9 @@ If the native item database supports another priority schema (such as a range fr 1.0

    -

    Code example:

      task.priority = "HIGH";
    - 
    +

    Code example:

    +task.priority = "HIGH";
    +
  • @@ -2551,12 +2629,13 @@ If the native item database supports another priority schema (such as a range fr 1.0

    -

    Code example:

      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];
    - 
    +

    Code example:

    +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];
    +
  • @@ -2578,8 +2657,9 @@ By default, this attribute is set to an empty array. 1.0

    -

    Code example:

      event.categories = ['Personal'];
    - 
    +

    Code example:

    +event.categories = ['Personal'];
    +
  • @@ -2598,10 +2678,11 @@ By default, this attribute is set to an empty array. 1.0

    -

    Code example:

      var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
    -                                           {role: "CHAIR", RSVP: true});
    -  event.attendees = [attendee];
    - 
    +

    Code example:

    +var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
    +                                          {role: "CHAIR", RSVP: true});
    +event.attendees = [attendee];
    +
  • @@ -2666,24 +2747,27 @@ The export format is set using the format parameter.
    -

    Code example:

      // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -2732,18 +2816,19 @@ The CalendarItem object returned by the clone() method will ha
    -

    Code example:

      // Gets the default calendar.
    -  var calendar = tizen.calendar.getDefaultCalendar();
    +

    Code example:

    +/* 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);
    - 
    +calendar.add(html5seminar); +var tizenseminar = html5seminar.clone(); +tizenseminar.summary = "Tizen Seminar"; +calendar.add(tizenseminar); +
    @@ -2768,39 +2853,47 @@ The CalendarItem object returned by the clone() method will ha 1.0

    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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);
    +
    @@ -2833,8 +2926,9 @@ The default value is null. If no value is provided, the task does not 1.0

    -

    Code example:

      task.dueDate = new tizen.TZDate(2011, 2, 11);
    - 
    +

    Code example:

    +task.dueDate = new tizen.TZDate(2011, 2, 11);
    +
  • @@ -2855,8 +2949,9 @@ The default value is null. If no value is provided, the task is not c 1.0

    -

    Code example:

      task.completedDate = new tizen.TZDate(2011, 2, 11);
    - 
    +

    Code example:

    +task.completedDate = new tizen.TZDate(2011, 2, 11);
    +
  • @@ -2880,8 +2975,9 @@ The default value is 0, implies that the task has not been started. 1.0

    -

    Code example:

      task.progress = 50; // 50% done
    - 
    +

    Code example:

    +task.progress = 50; /* 50% done */
    +
  • @@ -2913,36 +3009,44 @@ The default value is 0, implies that the task has not been started. 1.0

    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    -

    Code example:

     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" };
    +

    Code example:

    +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);
    - 
    +var ev = new tizen.CalendarEvent(eventInit); +
    @@ -2989,9 +3093,10 @@ The default value for this attribute is null. 1.0

    -

    Code example:

      // 2010-04-30 09:00
    -  event.endDate = new tizen.TZDate(2010, 3, 30, 9, 0);
    - 
    +

    Code example:

    +/* 2010-04-30 09:00 */
    +event.endDate = new tizen.TZDate(2010, 3, 30, 9, 0);
    +
  • @@ -3027,10 +3132,11 @@ The detached instances (specific instances that have been modified as saved to t 1.0

    -

    Code example:

      // Repeats daily for 7 days.
    -  var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount: 7});
    -  event.recurrenceRule = rule;
    - 
    +

    Code example:

    +/* Repeats daily for 7 days */
    +var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount: 7});
    +event.recurrenceRule = rule;
    +
  • @@ -3113,29 +3219,31 @@ UnknownError - if any other error occurs.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    @@ -3208,10 +3316,11 @@ By default, each of the attributes of this interface are undefined.

    -

    Code example:

      var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
    -                                           {role: "CHAIR", RSVP: true});
    -  event.attendees = [attendee];
    - 
    +

    Code example:

    +var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
    +                                          {role: "CHAIR", RSVP: true});
    +event.attendees = [attendee];
    +

    Constructors

    @@ -3404,10 +3513,11 @@ For more information about the members, see CalendarRecurrenceRule inte 1.0

    -

    Code example:

      // Repeats daily for 7 days.
    -  var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount:7});
    -  event.recurrenceRule = rule;
    - 
    +

    Code example:

    +/* Repeats daily for 7 days */
    +var rule = new tizen.CalendarRecurrenceRule("DAILY", {occurrenceCount:7});
    +event.recurrenceRule = rule;
    +

    Constructors

    @@ -3657,12 +3767,13 @@ By default, this attribute is set to null. 1.0

    -

    Code example:

     // Creates a sound alarm at the specified time
    - var alarm1 = new tizen.CalendarAlarm(new tizen.TZDate(2011, 3, 30, 10, 0), "SOUND");
    +

    Code example:

    +/* 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");
    - 
    +/* Creates a sound alarm before an event starts */ +var alarm2 = new tizen.CalendarAlarm(new tizen.TimeDuration(1, "MINS"), "SOUND"); +

    Constructors

    @@ -3779,29 +3890,31 @@ The default value is an empty string.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    @@ -3846,27 +3959,33 @@ The default value is an empty string.
    -

    Code example:

      // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -3911,45 +4030,53 @@ The default value is an empty string.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3997,30 +4124,38 @@ The default value is an empty string.
    -

    Code example:

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

    Code example:

    +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'
    +});
    +
    @@ -4046,32 +4181,41 @@ The default value is an empty string.
    -

    Code example:

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

    Code example:

    +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'
    +});
    +
    @@ -4097,32 +4241,41 @@ The default value is an empty string.
    -

    Code example:

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

    Code example:

    +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'
    +});
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/callhistory.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/callhistory.html index 94e8bed..8c245fe 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/callhistory.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/callhistory.html @@ -436,64 +436,55 @@ If the limit is 0, the query result has no limit.
    -

    Code example:

     // 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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -548,21 +539,23 @@ If the limit is 0, the query result has no limit.
    -

    Code example:

     // 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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -630,20 +623,22 @@ UnknownError - If any other error occurs.
    -

    Code example:

     // 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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -763,37 +758,48 @@ UnknownError - If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/contact.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/contact.html index e7fba8c..6d40ecc 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/contact.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/contact.html @@ -659,58 +659,72 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -762,53 +776,69 @@ and it is set to null.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -857,53 +887,69 @@ The default address book is one of the addressBooks that is the appointed addres
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -962,20 +1008,22 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1043,21 +1091,23 @@ to an unknown error.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1122,16 +1172,20 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1202,17 +1256,21 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1273,29 +1331,38 @@ to an unknown error.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    @@ -1369,33 +1436,44 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    @@ -1461,31 +1539,43 @@ to an unknown error.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    @@ -1559,34 +1649,47 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    @@ -1669,28 +1772,33 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    @@ -1773,29 +1881,35 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     3 results found.
    @@ -1867,23 +1981,28 @@ contain an invalid value.
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1952,29 +2071,35 @@ with the given identifier.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2075,22 +2200,24 @@ This interface also offers the following methods to manipulate groups within the
    -

    Code example:

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

    Code example:

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

    Constructors

    @@ -2218,16 +2345,20 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2299,23 +2430,33 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2402,39 +2543,57 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2495,35 +2654,44 @@ to an unknown error.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2598,39 +2766,50 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2699,37 +2878,49 @@ to an unknown error.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2800,40 +2991,53 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2917,34 +3121,38 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3016,24 +3224,29 @@ contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3102,30 +3315,36 @@ with the given identifier.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3190,16 +3409,20 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3266,19 +3489,23 @@ contains invalid values.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3336,20 +3563,24 @@ to an unknown error.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3416,19 +3647,23 @@ to an unknown error.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3485,18 +3720,22 @@ to an unknown error.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3726,27 +3965,36 @@ contains invalid values.
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    @@ -3901,15 +4160,16 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var myPersonId = '1'; // ID of person
    - var person = tizen.contact.get(myPersonId);
    +

    Code example:

    +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);
    - 
    +console.log('Number of outgoing calls: ' + outCalls); +console.log('Number of all usages: ' + allUsages); +

    Output example:

     Number of outgoing calls: 12
    @@ -3966,12 +4226,13 @@ is not compatible with the expected type for that parameter.
     
             
    -

    Code example:

     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());
    - 
    +

    Code example:

    +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());
    +

    Output example:

     Usage count before reset: 2
    @@ -4077,72 +4338,91 @@ This dictionary is used to input parameters when contacts are created.
      1.0
               

    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Constructors

    @@ -4232,10 +4512,12 @@ By default, this attribute is set to false. 1.0

    -

    Code example:

       if (contact.isFavorite) {
    -     // ...
    -   }
    - 
    +

    Code example:

    +if (contact.isFavorite)
    +{
    +   /* Do something */
    +}
    +
  • @@ -4262,13 +4544,17 @@ By default, this attribute is set to an empty array. 1.0

    -

    Code example:

     var contactInit = {};
    - var contactAddr = new tizen.ContactAddress({streetAddress:'Gran Via, 32',
    -                                             postalCode:'50013',
    -                                             city:'Zaragoza',
    -                                             country:'ES'});
    - contactInit.addresses = [contactAddr];
    - 
    +

    Code example:

    +var contactInit = {};
    +var contactAddr = new tizen.ContactAddress(
    +{
    +   streetAddress:'Gran Via, 32',
    +   postalCode:'50013',
    +   city:'Zaragoza',
    +   country:'ES'
    +});
    +contactInit.addresses = [contactAddr];
    +
  • @@ -4290,11 +4576,13 @@ By default, this attribute is set to null. 1.0

    -

    Code example:

      var contactInit = {};
    -  tizen.filesystem.resolve('images/mypicture.jpg', function(imageFile) {
    -    contactInit.photoURI = imageFile.toURI();
    -  });
    - 
    +

    Code example:

    +var contactInit = {};
    +tizen.filesystem.resolve('images/mypicture.jpg', function(imageFile)
    +{
    +   contactInit.photoURI = imageFile.toURI();
    +});
    +
  • @@ -4312,10 +4600,11 @@ By default, this attribute is set to an empty array. 1.0

    -

    Code example:

       var contactInit = {};
    -   var phoneNumber = new tizen.ContactPhoneNumber('123456789');
    -   contactInit.phoneNumbers = [phoneNumber];
    - 
    +

    Code example:

    +var contactInit = {};
    +var phoneNumber = new tizen.ContactPhoneNumber('123456789');
    +contactInit.phoneNumbers = [phoneNumber];
    +
  • @@ -4333,10 +4622,11 @@ By default, this attribute is set to an empty array. 1.0

    -

    Code example:

       var contactInit = {};
    -   var email = new tizen.ContactEmailAddress('deedee@ramones.com');
    -   contactInit.emails = [email];
    - 
    +

    Code example:

    +var contactInit = {};
    +var email = new tizen.ContactEmailAddress('deedee@ramones.com');
    +contactInit.emails = [email];
    +
  • @@ -4354,10 +4644,11 @@ By default, this attribute is set to an empty array. 2.3

    -

    Code example:

       var contactInit = {};
    -   var messenger = new tizen.ContactInstantMessenger('user@example.com');
    -   contactInit.messengers = [messenger];
    - 
    +

    Code example:

    +var contactInit = {};
    +var messenger = new tizen.ContactInstantMessenger('user@example.com');
    +contactInit.messengers = [messenger];
    +
  • @@ -4378,11 +4669,12 @@ By default, this attribute is set to an empty array. 2.3

    -

    Code example:

       var contactInit = {};
    -   // Contact is brother of 'Anna'.
    -   var relationship = new tizen.ContactRelationship('Anna', "BROTHER");
    -   contactInit.relationships = [relationship];
    - 
    +

    Code example:

    +var contactInit = {};
    +/* Contact is brother of 'Anna' */
    +var relationship = new tizen.ContactRelationship('Anna', "BROTHER");
    +contactInit.relationships = [relationship];
    +
  • @@ -4400,10 +4692,11 @@ By default, this attribute is set to an empty array. 3.0

    -

    Code example:

      var contactInit = {};
    -  var extension =  new tizen.ContactExtension({ data1: 20, data2: 'Place of birth: Elbląg' });
    -  contactInit.extensions = [extension];
    - 
    +

    Code example:

    +var contactInit = {};
    +var extension = new tizen.ContactExtension({data1: 20, data2: 'Place of birth: Elbląg'});
    +contactInit.extensions = [extension];
    +
  • @@ -4423,9 +4716,10 @@ By default, this attribute is set to null. 1.0

    -

    Code example:

       var contactInit = {};
    -   contactInit.birthday = new Date(1996, 4, 15);
    - 
    +

    Code example:

    +var contactInit = {};
    +contactInit.birthday = new Date(1996, 4, 15);
    +
  • @@ -4446,10 +4740,11 @@ By default, this attribute is set to an empty array. 1.0

    -

    Code example:

       var contactInit = {};
    -   var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage');
    -   contactInit.anniversaries = [marriage_anniv];
    - 
    +

    Code example:

    +var contactInit = {};
    +var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage');
    +contactInit.anniversaries = [marriage_anniv];
    +
  • @@ -4638,35 +4933,44 @@ is not compatible with the expected type for that parameter.
  • -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -4708,17 +5012,17 @@ set to null and will be detached from any address book.
    -

    Code example:

      // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -4753,17 +5057,18 @@ This interface is used by other APIs to uniquely and globally identify contacts.
    ContactRef(AddressBookId addressBookId, ContactId contactId);
    -

    Code example:

       // Gets the default address book.
    -   var addressbook = tizen.contact.getDefaultAddressBook();
    +

    Code example:

    +/* 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);
    - 
    +/* Creates a reference to this contact */ +var refToEve = new tizen.ContactRef(addressbook.id, eve.id); +
    @@ -4853,9 +5158,12 @@ See the ContactName interface for more information about the members.
    ContactName(optional ContactNameInit? nameInitDict);
    -

    Code example:

       var myContactName = new tizen.ContactName(
    -      {prefix : "Mr.", firstName : "John", lastName : "Doe"});
    - 
    +

    Code example:

    +var myContactName = new tizen.ContactName(
    +{
    +   prefix: "Mr.", firstName: "John", lastName: "Doe"
    +});
    +
    @@ -4877,8 +5185,9 @@ By default, this attribute is initialized to 1.0

    -

    Code example:

       contact.name.prefix = "Dr.";
    - 
    +

    Code example:

    +contact.name.prefix = "Dr.";
    +
  • @@ -4896,8 +5205,9 @@ By default, this attribute is initialized to 2.0

    -

    Code example:

       contact.name.suffix = "Jr.";
    - 
    +

    Code example:

    +contact.name.suffix = "Jr.";
    +
  • @@ -4915,8 +5225,9 @@ By default, this attribute is initialized to 1.0

    -

    Code example:

       contact.name.firstName = 'Douglas';
    - 
    +

    Code example:

    +contact.name.firstName = 'Douglas';
    +
  • @@ -4934,8 +5245,9 @@ By default, this attribute is initialized to 1.0

    -

    Code example:

       contact.name.middleName = 'Glenn';
    - 
    +

    Code example:

    +contact.name.middleName = 'Glenn';
    +
  • @@ -4953,8 +5265,9 @@ By default, this attribute is initialized to 1.0

    -

    Code example:

       contact.name.lastName = 'Colvin';
    - 
    +

    Code example:

    +contact.name.lastName = 'Colvin';
    +
  • @@ -4980,8 +5293,9 @@ See RFC 2426, Section 3.1.3. 1.0

    -

    Code example:

       contact.name.nickNames = ['Dee Dee'];
    - 
    +

    Code example:

    +contact.name.nickNames = ['Dee Dee'];
    +
  • @@ -5120,8 +5434,9 @@ For more details, see RFC 2426, Section 3.5.

    -

    Code example:

     var organization = new tizen.ContactOrganization({name: "Nice Company", role: "SW Engineer"});
    - 
    +

    Code example:

    +var organization = new tizen.ContactOrganization({name: "Nice Company", role: "SW Engineer"});
    +

    Constructors

    @@ -5233,10 +5548,11 @@ For more details, see RFC 2426, Section 3.6.8.

    -

    Code example:

      var contactInit = {}
    -  var blog = new tizen.ContactWebSite('http://www.domain.com', 'BLOG');
    -  contactInit.urls = [blog];
    - 
    +

    Code example:

    +var contactInit = {}
    +var blog = new tizen.ContactWebSite('http://www.domain.com', 'BLOG');
    +contactInit.urls = [blog];
    +

    Constructors

    @@ -5297,10 +5613,11 @@ By default, this attribute is set to HOMEPAGE. 1.0

    -

    Code example:

      var contactInit = {}
    -  var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage');
    -  contactInit.anniversaries = [marriage_anniv];
    - 
    +

    Code example:

    +var contactInit = {}
    +var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage');
    +contactInit.anniversaries = [marriage_anniv];
    +

    Constructors

    @@ -5402,12 +5719,16 @@ For more details, see RFC 2426, Section 3.2.1.

    -

    Code example:

       var contactInit = {};
    -   var contactAddress = new tizen.ContactAddress({streetAddress:'Gran Via, 32',
    -                                                  postalCode:'50013', city:'Zaragoza',
    -                                                 country:'ES', types:['WORK']});
    -   contactInit.contactAddress = [contactAddress];
    - 
    +

    Code example:

    +var contactInit = {};
    +var contactAddress = new tizen.ContactAddress(
    +{
    +   streetAddress:'Gran Via, 32',
    +   postalCode:'50013', city:'Zaragoza',
    +   country:'ES', types:['WORK']
    +});
    +contactInit.contactAddress = [contactAddress];
    +

    Constructors

    @@ -5587,10 +5908,11 @@ For more details, see RFC 2426, Section 3.3.1

    -

    Code example:

       var contactInit = {};
    -   var phoneNumber = new tizen.ContactPhoneNumber('123456789', ['WORK','VOICE'], true);
    -   contactInit.phoneNumbers = [phoneNumber];
    - 
    +

    Code example:

    +var contactInit = {};
    +var phoneNumber = new tizen.ContactPhoneNumber('123456789', ['WORK','VOICE'], true);
    +contactInit.phoneNumbers = [phoneNumber];
    +

    Constructors

    @@ -5729,10 +6051,11 @@ For more details, see RFC 2426, Section 3.3.2.

    -

    Code example:

      var contactInit = {};
    -  var email = new tizen.ContactEmailAddress('user@domain.com', ['WORK']);
    -  contactInit.emails = [email];
    - 
    +

    Code example:

    +var contactInit = {};
    +var email = new tizen.ContactEmailAddress('user@domain.com', ['WORK']);
    +contactInit.emails = [email];
    +

    Constructors

    @@ -5845,10 +6168,11 @@ By default, this attribute is initialized to null. 2.3

    -

    Code example:

      var contactInit = {};
    -  var messenger = new tizen.ContactInstantMessenger('user@domain.com', 'GOOGLE');
    -  contactInit.messengers = [messenger];
    - 
    +

    Code example:

    +var contactInit = {};
    +var messenger = new tizen.ContactInstantMessenger('user@domain.com', 'GOOGLE');
    +contactInit.messengers = [messenger];
    +

    Constructors

    @@ -5922,41 +6246,50 @@ By default, this attribute is initialized to null. 2.0

    -

    Code example:

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

    Code example:

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

    Constructors

    @@ -6080,11 +6413,12 @@ See code example below.

    -

    Code example:

      var contactInit = {};
    -  // Contact is brother of 'Anna'
    -  var relationship = new tizen.ContactRelationship('Anna', 'BROTHER');
    -  contactInit.relationships = [relationship];
    - 
    +

    Code example:

    +var contactInit = {};
    +/* Contact is brother of 'Anna' */
    +var relationship = new tizen.ContactRelationship('Anna', 'BROTHER');
    +contactInit.relationships = [relationship];
    +

    Constructors

    @@ -6205,17 +6539,19 @@ See code example below.

    -

    Code example:

     var name = new tizen.ContactName({ firstName: 'Anna' });
    +

    Code example:

    +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'
    - 
    +console.log(contact1.extensions[1].data3); /* It shows: 'Favourite color: green' */ +

    Constructors

    @@ -6381,25 +6717,32 @@ get or save a list of persons.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -6500,18 +6843,21 @@ get address books.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -6566,36 +6912,49 @@ book change occurs (contact addition/update/deletion).
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -6621,46 +6980,59 @@ book change occurs (contact addition/update/deletion).
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -6686,50 +7058,65 @@ book change occurs (contact addition/update/deletion).
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -6783,23 +7170,28 @@ list change occurs (person addition/update/deletion).
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -6825,23 +7217,28 @@ list change occurs (person addition/update/deletion).
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -6867,23 +7264,28 @@ list change occurs (person addition/update/deletion).
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/content.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/content.html index b3381c4..421d041 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/content.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/content.html @@ -450,13 +450,15 @@ contain an invalid value.
  • -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -531,23 +533,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -598,21 +604,26 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // The following example retrieves content directories in the storage.
    +

    Code example:

    +/* 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);
    - 
    +function getDirectoriesCB(directories) +{ +   directories.forEach(printDirectory); +} + +tizen.content.getDirectories(getDirectoriesCB, errorCB); +
    @@ -699,35 +710,40 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -799,21 +815,24 @@ contain an invalid value (e.g. given contentURI is an empty string).
    -

    Code example:

     // The following example scan 'tizen.jpg' in media directory
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +/* 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');
    +}
     
    - 
    +tizen.filesystem.resolve("images/tizen.jpg", function(imageFile) +{ +   tizen.content.scanFile(imageFile.toURI(), successCB, errorCB); +}); +
    @@ -893,21 +912,24 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

     // The following example scans 'images' directory
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +/* 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');
    +}
     
    - 
    +tizen.filesystem.resolve("images", function(directory) +{ +   tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB); +}); +
    @@ -962,9 +984,9 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

     tizen.content.cancelScanDirectory(directory.toURI());
    -
    - 
    +

    Code example:

    +tizen.content.cancelScanDirectory(directory.toURI());
    +
    @@ -1006,32 +1028,40 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

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

    Code example:

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

    Output example:

     Listener ID: 1
    @@ -1069,34 +1099,42 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1152,31 +1190,38 @@ developers to add a listener and get notified when content is added, removed or
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1216,9 +1261,9 @@ developers to add a listener and get notified when content is added, removed or
    -

    Code example:

     tizen.content.unsetChangeListener();
    -
    - 
    +

    Code example:

    +tizen.content.unsetChangeListener();
    +
    @@ -1277,24 +1322,28 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1363,50 +1412,58 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1469,44 +1526,51 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1571,18 +1635,22 @@ AbortError: In case of any error.
    -

    Code example:

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

    Code example:

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

    Output example:

     The thumbnail path is /home/owner/share/media/.thumb/phone/.jpg-bed1d5f494830f7a52e1217f1e924aff.jpg
    @@ -2820,59 +2888,71 @@ UnknownError: In case of any error              
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2935,69 +3015,82 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3066,38 +3159,46 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3162,74 +3263,89 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3307,69 +3423,84 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/console.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/console.html index dd88313..edecbf9 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/console.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/console.html @@ -3,7 +3,7 @@ -Console API +Console API
    @@ -121,8 +121,7 @@ The text will be logged as a standard message.
    -

    Code example:

     console.log('A is for Alice.');
    - 
    +

    Code example:

    console.log('A is for Alice.');

    Output example:

    A is for Alice.
    @@ -153,8 +152,7 @@ The text will be logged as an error message.
             
     
    -

    Code example:

     console.error('B is for Bob.');
    - 
    +

    Code example:

    console.error('B is for Bob.');

    Output example:

    B is for Bob.
    @@ -185,8 +183,7 @@ The text will be logged as a warning message.
             
     
    -

    Code example:

     console.warn('C is for Christopher.');
    - 
    +

    Code example:

    console.warn('C is for Christopher.');

    Output example:

    C is for Christopher.
    @@ -217,8 +214,7 @@ The text will be logged as an info message.
             
     
    -

    Code example:

     console.info('D is for Dorothy.');
    - 
    +

    Code example:

    console.info('D is for Dorothy.');

    Output example:

    D is for Dorothy.
    @@ -249,8 +245,7 @@ The text will be logged as a debug message.
             
     
    -

    Code example:

     console.debug('E is for Eve.');
    - 
    +

    Code example:

    console.debug('E is for Eve.');

    Output example:

    E is for Eve.
    @@ -285,11 +280,12 @@ the message is written to the console.
             
     
    -

    Code example:

     var felix = 'Felix';
    +

    Code example:

    +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.');
    - 
    +/* This assertion checks whether the first letter in name 'Felix' is 'A' */ +console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.'); +

    Output example:

    Felix does not start with A.
    @@ -321,9 +317,10 @@ Object view is forced.
             
     
    -

    Code example:

     var john = {name: "John", surname: "Doe"};
    - console.dir(john.name);
    - 
    +

    Code example:

    +var john = {name: "John", surname: "Doe"};
    +console.dir(john.name);
    +

    Output example:

    John
    @@ -354,9 +351,10 @@ if possible or the JavaScript Object if it is not.
             
     
    -

    Code example:

     var john = {name: "John", surname: "Doe"};
    - console.dirxml(john.surname);
    - 
    +

    Code example:

    +var john = {name: "John", surname: "Doe"};
    +console.dirxml(john.surname);
    +

    Output example:

    Doe
    @@ -388,13 +386,15 @@ is displayed in the console. Timer values are accurate to the sub-millisecond.
             
     
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +

    Output example:

    Big array initialization: 461.989ms
    @@ -424,13 +424,15 @@ is displayed in the console. Timer values are accurate to the sub-millisecond.
             
     
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +

    Output example:

    Big array initialization: 461.989ms
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/cordova.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/cordova.html
    index 50365fd..b596947 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/cordova.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/cordova.html
    @@ -3,7 +3,7 @@
     
     
     
    -Cordova API
    +Cordova API
     
     
     
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device-motion.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device-motion.html index 4326230..cd18e3c 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device-motion.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device-motion.html @@ -3,7 +3,7 @@ -DeviceMotion API +DeviceMotion API

    Output example:

    Acceleration X: 0.00
    @@ -197,22 +200,25 @@ Timestamp: 1456480118000
     
             
    -

    Code example:

     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...');
    - };
    +

    Code example:

    +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);
    - 
    +var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options); +

    Output example:

    Acceleration X: 0.00
    @@ -259,26 +265,30 @@ Please wait 3 seconds for the next measurement...
     
             
    -

    Code example:

     var counter = 0, watchID;
    +

    Code example:

    +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);
    - 
    +watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options); +

    Output example:

    Acceleration X: 0.00
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device.html
    index 974550e..80e68c9 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/device.html
    @@ -3,7 +3,7 @@
     
     
     
    -Device API
    +Device API
     
     
     
     
     
     
     
     

    Output example:

    Device Version: 3.0
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/dialogs.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/dialogs.html
    index 10d12b0..1143a2c 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/dialogs.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/dialogs.html
    @@ -3,7 +3,7 @@
     
     
     
    -Dialogs API
    +Dialogs API
     
     
     
    @@ -140,13 +140,15 @@ The navigator.notification object allows access to the Dialogs API.
    -

    Code example:

     var alertDismissed = function() {
    -    console.log('Alert was dismissed');
    - }
    +

    Code example:

    +var alertDismissed = function()
    +{
    +   console.log('Alert was dismissed');
    +}
     
    - navigator.notification.alert('Please click OK button', alertDismissed,
    -                              'OK click alert', 'OK');
    - 
    +navigator.notification.alert('Please click OK button', alertDismissed, +                             'OK click alert', 'OK'); +

    Output example:

    Alert was dismissed
    @@ -189,13 +191,15 @@ Callback provides index of button pressed (1,2,3 etc.) or 0, if dialog was dismi
             
     
    -

    Code example:

     var confirmCallback = function(buttonIndex) {
    -    console.log('Selected option was ' + buttonIndex);
    - }
    +

    Code example:

    +var confirmCallback = function(buttonIndex)
    +{
    +   console.log('Selected option was ' + buttonIndex);
    +}
     
    - navigator.notification.confirm('Choose one option', confirmCallback,
    -                              'Options', ['Option1', 'Option2']);
    - 
    +navigator.notification.confirm('Choose one option', confirmCallback, +                               'Options', ['Option1', 'Option2']); +

    Output example:

    Selected option was 1
    @@ -242,16 +246,15 @@ Callback provides PromptData object, which holds all data provided by u
             
     
    -

    Code example:

     var promptCallback = function(results) {
    -    console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
    - }
    +

    Code example:

    +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');
    - 
    +navigator.notification.prompt('Please enter your name', promptCallback, +                              'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe'); +

    Output example:

    Hello Jane Doe, you selected option 1
    @@ -281,10 +284,11 @@ Callback provides PromptData object, which holds all data provided by u
             
     
    -

    Code example:

     var times = 2;
    - console.log('Device would beep ' + times + ' times');
    - navigator.notification.beep(times);
    - 
    +

    Code example:

    +var times = 2;
    +console.log('Device would beep ' + times + ' times');
    +navigator.notification.beep(times);
    +
    @@ -243,16 +245,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova pause event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('pause', onPause, false);
    - }
    -
    - function onPause() {
    -   // Handle the pause event
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('pause', onPause, false);
    +}
    +
    +function onPause()
    +{
    +   /* Handle the pause event */
    +}
    +
    @@ -279,16 +284,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova resume event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('resume', onResume, false);
    - }
    -
    - function onResume() {
    -   // Handle the resume event
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('resume', onResume, false);
    +}
    +
    +function onResume()
    +{
    +   /* Handle the resume event */
    +}
    +
    @@ -313,16 +321,19 @@ It is no longer necessary to call any other method to override the back-button b Original documentation: Cordova backbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('backbutton', onBackKeyDown, false);
    - }
    -
    - function onBackKeyDown() {
    -    // Handle the back button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('backbutton', onBackKeyDown, false);
    +}
    +
    +function onBackKeyDown()
    +{
    +   /* Handle the back button */
    +}
    +
    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('menubutton', onMenuKeyDown, false);
    - }
    -
    - function onMenuKeyDown() {
    -   // Handle the back button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('menubutton', onMenuKeyDown, false);
    +}
    +
    +function onMenuKeyDown()
    +{
    +   /* Handle the back button */
    +}
    +
    @@ -385,16 +399,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova searchbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('searchbutton', onSearchKeyDown, false);
    - }
    -
    - function onSearchKeyDown() {
    -   // Handle the search button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('searchbutton', onSearchKeyDown, false);
    +}
    +
    +function onSearchKeyDown()
    +{
    +   /* Handle the search button */
    +}
    +
    @@ -421,16 +438,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova startcallbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('startcallbutton', onStartCallKeyDown, false);
    - }
    -
    - function onStartCallKeyDown() {
    -   // Handle the start call button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('startcallbutton', onStartCallKeyDown, false);
    +}
    +
    +function onStartCallKeyDown()
    +{
    +   /* Handle the start call button */
    +}
    +
    @@ -457,16 +477,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova endcallbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('endcallbutton', onEndCallKeyDown, false);
    - }
    -
    - function onEndCallKeyDown() {
    -   // Handle the end call button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('endcallbutton', onEndCallKeyDown, false);
    +}
    +
    +function onEndCallKeyDown()
    +{
    +   /* Handle the end call button */
    +}
    +
    @@ -493,16 +516,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova volumedownbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
    - }
    -
    - function onVolumeDownKeyDown() {
    -   // Handle the volume down button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
    +}
    +
    +function onVolumeDownKeyDown()
    +{
    +   /* Handle the volume down button */
    +}
    +
    @@ -529,16 +555,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova volumeupbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
    - }
    -
    - function onVolumeUpKeyDown() {
    -   // Handle the volume up button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
    +}
    +
    +function onVolumeUpKeyDown()
    +{
    +   /* Handle the volume up button */
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/file.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/file.html index b5af2e9..9756308 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/file.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/file.html @@ -3,7 +3,7 @@ -File API +File API

    Constructors

    @@ -501,8 +503,7 @@ This manager interface exposes the Filesystem base API constants. 3.0

    -

    Code example:

     console.log("The directory where the application is installed " + cordova.file.applicationDirectory);
    - 
    +

    Code example:

    console.log("The directory where the application is installed " + cordova.file.applicationDirectory);

    Output example:

    The directory where the application is installed file:///opt/usr/apps/WfigBlWDyf/res/wgt/
    @@ -519,8 +520,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);
    - 
    +

    Code example:

    console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);

    Output example:

    Root directory of the application's sandbox file:///opt/usr/apps/WfigBlWDyf/
    @@ -537,8 +537,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Data directory " + cordova.file.dataDirectory);
    - 
    +

    Code example:

    console.log("Data directory " + cordova.file.dataDirectory);

    Output example:

    Data directory file:///opt/usr/apps/WfigBlWDyf/data/
    @@ -555,8 +554,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Cache directory " + cordova.file.cacheDirectory);
    - 
    +

    Code example:

    console.log("Cache directory " + cordova.file.cacheDirectory);

    Output example:

    Cache directory file:///opt/usr/apps/WfigBlWDyf/tmp/
    @@ -573,8 +571,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);
    - 
    +

    Code example:

    console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);

    Output example:

    Space on external storage null
    @@ -591,8 +588,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Data files on external storage " + cordova.file.externalDataDirectory);
    - 
    +

    Code example:

    console.log("Data files on external storage " + cordova.file.externalDataDirectory);

    Output example:

    Data files on external storage null
    @@ -609,8 +605,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Cache on external storage " + cordova.file.externalCacheDirectory);
    - 
    +

    Code example:

    console.log("Cache on external storage " + cordova.file.externalCacheDirectory);

    Output example:

    Cache on external storage null
    @@ -627,8 +622,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Root on external storage " + cordova.file.externalRootDirectory);
    - 
    +

    Code example:

    console.log("Root on external storage " + cordova.file.externalRootDirectory);

    Output example:

    Root on external storage file:///usr/storage/sdcard/
    @@ -645,8 +639,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Temp directory " + cordova.file.tempDirectory);
    - 
    +

    Code example:

    console.log("Temp directory " + cordova.file.tempDirectory);

    Output example:

    Temp directory null
    @@ -663,8 +656,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Synced data directory " + cordova.file.syncedDataDirectory);
    - 
    +

    Code example:

    console.log("Synced data directory " + cordova.file.syncedDataDirectory);

    Output example:

    Synced data directory null
    @@ -681,8 +673,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Documents directory " + cordova.file.documentsDirectory);
    - 
    +

    Code example:

    console.log("Documents directory " + cordova.file.documentsDirectory);

    Output example:

    Documents directory null
    @@ -699,8 +690,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Files globally available to all applications " + cordova.file.sharedDirectory);
    - 
    +

    Code example:

    console.log("Files globally available to all applications " + cordova.file.sharedDirectory);

    Output example:

    Files globally available to all applications file:///opt/usr/media/
    @@ -743,10 +733,12 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
      3.0
                 

    -

    Code example:

     requestFileSystem(TEMPORARY, 100, function (fileSystem) {
    -        console.log('Name of the filesystem: '+fileSystem.name);
    - });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fileSystem)
    +{
    +   console.log('Name of the filesystem: ' + fileSystem.name);
    +});
    +

    Output example:

    Name of the filesystem: temporary
    @@ -1007,17 +999,19 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

     successCallback = function(fs) {
    -     console.log('File system name ' + fs.name);
    - };
    -
    - errorCallback = function(err) {
    -     console.log(err.code);
    - };
    -
    - requestFileSystem(TEMPORARY, 1024*1024, successCallback, errorCallback);
    -
    - 
    +

    Code example:

    +successCallback = function(fs)
    +{
    +   console.log('File system name ' + fs.name);
    +};
    +
    +errorCallback = function(err)
    +{
    +   console.log(err.code);
    +};
    +
    +requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
    +

    Output example:

    File system name temporary
    @@ -1070,18 +1064,20 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Entry name example.txt
    @@ -1224,12 +1220,15 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getMetadata(function (metadata) {
    -       console.log("Last modification time: " + metadata.modificationTime);// get metadata successfully
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getMetadata(function(metadata)
    +   {
    +      console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
    +   });
    +});
    +

    Output example:

    Last modification time: Fri Jan 02 2015 03:58:08 GMT+0900 (KST)
    @@ -1311,16 +1310,21 @@ A move of a directory on top of an existing empty directory must attempt to dele
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Full path before move: /aa.txt
    @@ -1404,18 +1408,20 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Full path to the copied file: /testDirectory/newname.txt
    @@ -1464,12 +1470,15 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getParent(function (entry) {
    -       console.log("success");
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getParent(function(entry)
    +   {
    +      console.log("success");
    +   });
    +});
    +

    Output example:

    success
    @@ -1522,14 +1531,18 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile('test.txt', {create: true}, function(fileEntry) {
    -       fileEntry.remove(function () {
    -         console.log("success");
    -       });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile('test.txt', {create: true}, function(fileEntry)
    +   {
    +      fileEntry.remove(function()
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -1554,14 +1567,16 @@ Directory copies are always recursive--that is, they copy all contents of the di
      URL that can be used to identify this entry.
                   
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory('testDirectory', {create:true},
    -       function(entry) {
    -         var url = entry.toURL();
    -         console.log('URL: '+url);
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory('testDirectory', {create:true}, function(entry)
    +   {
    +      var url = entry.toURL();
    +      console.log('URL: ' + url);
    +   });
    +});
    +

    Output example:

    URL: file:///home/owner/apps_rw/WfigBlWDyf/tmp/testDirectory/
    @@ -1620,12 +1635,15 @@ Directory copies are always recursive--that is, they copy all contents of the di
      DirectoryReader
                   
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function (entry) {
    -     entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry) {
    -          var directoryReader = dirEntry.createReader();
    -      });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(entry)
    +{
    +   entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
    +   {
    +      var directoryReader = dirEntry.createReader();
    +   });
    +});
    +
    @@ -1696,12 +1714,15 @@ Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry c
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory("ert",{create:true},function(dir){
    -         console.log('Created dir: '+dir.name);
    -      })
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory("ert", {create:true}, function(dir)
    +   {
    +      console.log('Created dir: ' + dir.name);
    +   })
    +});
    +

    Output example:

    Created dir: ert
    @@ -1776,12 +1797,15 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile("qa.txt",{create:true},function(file){
    -           console.log('Created file: '+file.name);
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile("qa.txt", {create:true}, function(file)
    +   {
    +      console.log('Created file: ' + file.name);
    +   });
    +});
    +

    Output example:

    Created file: qa.txt
    @@ -1834,15 +1858,18 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory("testDirectory", {create:true},
    -       function(directoryEntry) {
    -         directoryEntry.removeRecursively(function() {
    -           console.log("success");
    -         });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
    +   {
    +      directoryEntry.removeRecursively(function()
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -1906,13 +1933,16 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     var a = fs.root.createReader();
    -     a.readEntries(function successCallback(entries) {
    -       console.log("success");
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   var a = fs.root.createReader();
    +   a.readEntries(function successCallback(entries)
    +   {
    +      console.log("success");
    +   });
    +});
    +

    Output example:

    success
    @@ -1976,20 +2006,26 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
             
     
    -

    Code example:

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

    Code example:

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

    Output example:

    success
    @@ -2031,14 +2067,18 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
             
     
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile("abcdz.txt", {create: true}, function (f) {
    -       f.file(function (file) {
    -         console.log("success");
    -       });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile("abcdz.txt", {create: true}, function(f)
    +   {
    +      f.file(function(file)
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -2090,12 +2130,14 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
      3.0
               

    -

    Code example:

     var deviceReady, fileReader;
    - deviceReady = function() {
    -     fileReader = new FileReader();
    - };
    - document.addEventListener('deviceready', deviceReady, true);
    - 
    +

    Code example:

    +var deviceReady, fileReader;
    +deviceReady = function()
    +{
    +   fileReader = new FileReader();
    +};
    +document.addEventListener('deviceready', deviceReady, true);
    +

    Constructors

    @@ -2236,17 +2278,20 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read 3.0

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +

    Output example:

    aborted
    @@ -2295,13 +2340,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    -  fileReader.readAsDataURL(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsDataURL(blob);
    +

    Output example:

    Loaded, result = data:;base64,YWJj
    @@ -2354,13 +2401,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    - fileReader.readAsText(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsText(blob);
    +

    Output example:

    Loaded, result = abc
    @@ -2409,13 +2458,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    - fileReader.readAsBinaryString(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsBinaryString(blob);
    +

    Output example:

    Loaded, result = abc
    @@ -2464,14 +2515,16 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     resultValue = fileReader.result;
    -      console.log("Result: "+resultValue.toString()+'
    '+'ByteLength: '+resultValue.byteLength); - }; - fileReader.readAsArrayBuffer(blob); -
    +

    Code example:

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

    Output example:

    Result: [object ArrayBuffer]
    @@ -2660,24 +2713,29 @@ ByteLength: 3
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    abort
    @@ -2719,18 +2777,21 @@ If the offset is a negative number the position of the file pointer is rewound.
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2771,21 +2832,25 @@ If the offset is a negative number the position of the file pointer is rewound.
    -

    Code example:

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

    Code example:

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

    Output example:

    truncate success
    @@ -2834,21 +2899,25 @@ If the offset is a negative number the position of the file pointer is rewound.
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    write success
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/filetransfer.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/filetransfer.html
    index c6f25f7..2591b06 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/filetransfer.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/filetransfer.html
    @@ -3,7 +3,7 @@
     
     
     
    -FileTransfer API
    +FileTransfer API
     
     
     
    @@ -169,34 +169,37 @@ The key / value type of download options values. Currently only supports header 3.0

    -

    Code example:

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

    Code example:

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

    Output example:

    Code = 200
    @@ -209,9 +212,10 @@ Sent = 1024
     
    FileUploadOptions(DOMString fileKey, DOMString fileName, DOMString mimeType, FileUploadParams params, HeaderFields headers, DOMString httpMethod);
    -

    Code example:

     // Creates a FileUploadOptions object.
    - var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
    - 
    +

    Code example:

    +/* Creates a FileUploadOptions object */
    +var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
    +
    @@ -502,9 +506,10 @@ Sent = 1024
    FileTransfer();
    -

    Code example:

     // Creates a FileTransfer object.
    - var file_transfer = new FileTransfer();
    - 
    +

    Code example:

    +/* Creates a FileTransfer object */
    +var file_transfer = new FileTransfer();
    +
    @@ -519,32 +524,36 @@ Sent = 1024 3.0

    -

    Code example:

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

    Code example:

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

    Output example:

    uploaded: 512
     uploaded: 1024
    -Success.  File uploaded.
    +Success. File uploaded.
     
    @@ -607,23 +616,26 @@ Success. File uploaded.
    -

    Code example:

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

    Code example:

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

    Output example:

    Code = 200
    @@ -687,30 +699,28 @@ Sent = 1024
             
     
    -

    Code example:

     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=='
    -     }
    -   }
    - );
    - 
    +

    Code example:

    +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=='
    +   }
    +});
    +

    Output example:

    download complete: file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
    @@ -739,26 +749,29 @@ Sent = 1024
      http://tizen.org/privilege/internet
                 

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +
    -

    Output example:

    An error has occured: Code = 4
    +

    Output example:

    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
     
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/globalization.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/globalization.html index b54d264..d1dce58 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/globalization.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/globalization.html @@ -3,7 +3,7 @@ -Globalization API +Globalization API
    @@ -263,15 +263,20 @@ during this method's execution.
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    Language: en-US
    @@ -323,15 +328,20 @@ occuring while getting a locale name.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    Locale: en-US
    @@ -387,17 +397,20 @@ passed as a parameter to the successCallback.
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    Date: 9/25/2012 4:21PM
    @@ -450,24 +463,25 @@ for example 'USD'.
     
             
    -

    Code example:

     // 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.'); }
    - );
    -
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    pattern: $#,##0.##;($#,##0.##)
    @@ -527,20 +541,23 @@ The default value is {type: 'wide', item: 'months'}                
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    month: January
    @@ -604,20 +621,25 @@ The default value is {formatLength: 'short', selector: 'date and time'}
             
    -

    Code example:

     // 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();
    - 
    +

    Code example:

    +/*
    +   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();
    +

    Output example:

    Date pattern: M/d/yyyy h:mm a
    @@ -667,14 +689,19 @@ the first day of a week.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    day: 1
    @@ -729,26 +756,26 @@ the pattern will be returned.
     
             
    -

    Code example:

     // 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' }
    - );
    -
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    pattern: #,##0.###
    @@ -811,16 +838,19 @@ errors occuring during this method's execution.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    dst: true
    @@ -884,37 +914,43 @@ The default value of this parameter is {type: 'decimal'}.
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    decimal number: 3.142
    @@ -973,22 +1009,23 @@ The default value is {formatLength: 'short', selector: 'date and time'}
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    month: 8, day: 25, year: 2012
    @@ -1047,16 +1084,19 @@ The default value is {type: 'decimal'}                
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    number: 1234.56
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/media.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/media.html
    index b54cbca..5aa9d31 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/media.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/media.html
    @@ -3,7 +3,7 @@
     
     
     
    -Media API
    +Media API
     
     
     
     
     

    Output example:

    Audio file has been played back.
    @@ -290,20 +294,23 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio duration is 281.035
    @@ -324,31 +331,36 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio file has been paused.
    @@ -369,19 +381,22 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

     successCallback = function() {
    -    console.log('Audio file has been played back.');
    - }
    +

    Code example:

    +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();
    - 
    +myMedia.play(); +

    Output example:

    Audio file has been played back.
    @@ -403,21 +418,24 @@ Applications should call the release function for any Media resource that is no
      3.0
                 

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +

    Output example:

    Audio file has been stopped or released.
    @@ -448,24 +466,28 @@ Audio file has been stopped or released.
             
     
    -

    Code example:

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

    Code example:

    +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);
      
    @@ -505,31 +527,36 @@ Audio file has been played back.
    -

    Code example:

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

    Code example:

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

    Output example:

    Playback volume has been muted.
    @@ -560,19 +587,22 @@ Audio file has been played back.
      http://tizen.org/privilege/mediacapture
                 

    -

    Code example:

     successCallback = function() {
    -    console.log('Started recording an audio file.');
    - }
    +

    Code example:

    +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();
    - 
    +myRecMedia.startRecord(); +

    Output example:

    Started recording an audio file.
    @@ -601,25 +631,29 @@ Audio file has been played back.
      http://tizen.org/privilege/mediacapture
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Started recording an audio file.
    @@ -641,24 +675,28 @@ Stopped recording an audio file.
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio playback has been stopped.
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/networkInformation.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/networkInformation.html
    index 81a6afb..1d0fc4a 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/networkInformation.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/cordova/networkInformation.html
    @@ -3,7 +3,7 @@
     
     
     
    -NetworkInformation API
    +NetworkInformation API
     
     
     
    @@ -112,23 +112,25 @@ The navigator.connection object allows access to the NetworkInformation http://tizen.org/privilege/telephony

    -

    Code example:

     function checkConnection() {
    -   var networkState = navigator.connection.type;
    +

    Code example:

    +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();
    - 
    +checkConnection(); +

    Output example:

    Connection type: Cell 3G connection
    @@ -165,8 +167,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.UNKNOWN);
    - 
    +

    Code example:

    console.log(Connection.UNKNOWN);

    Output example:

    unknown
    @@ -183,8 +184,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.ETHERNET);
    - 
    +

    Code example:

    console.log(Connection.ETHERNET);

    Output example:

    ethernet
    @@ -201,8 +201,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.WIFI);
    - 
    +

    Code example:

    console.log(Connection.WIFI);

    Output example:

    wifi
    @@ -219,8 +218,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_2G);
    - 
    +

    Code example:

    console.log(Connection.CELL_2G);

    Output example:

    2g
    @@ -237,8 +235,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_3G);
    - 
    +

    Code example:

    console.log(Connection.CELL_3G);

    Output example:

    3g
    @@ -255,8 +252,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_4G);
    - 
    +

    Code example:

    console.log(Connection.CELL_4G);

    Output example:

    4g
    @@ -273,8 +269,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL);
    - 
    +

    Code example:

    console.log(Connection.CELL);

    Output example:

    cellular
    @@ -291,8 +286,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.NONE);
    - 
    +

    Code example:

    console.log(Connection.NONE);

    Output example:

    none
    @@ -326,16 +320,19 @@ Applications typically should use document.addEventListener() to attach an event
     Original documentation: Cordova online event          

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    +

    Code example:

    +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
    - }
    - 
    +function onOnline() +{ +   /* Handle the online event */ +} +
    @@ -362,16 +359,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova offline event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    +

    Code example:

    +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
    - }
    - 
    +function onOffline() +{ +   /* Handle the offline event */ +} +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/datacontrol.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/datacontrol.html index 33575ec..81b4a6d 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/datacontrol.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/datacontrol.html @@ -227,25 +227,34 @@ DataControl API.
    -

    Code example:

     //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.
    +

    Code example:

    +/* 
    +   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);
    - }
    - 
    +/* 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); +} +
    @@ -394,29 +403,34 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id, insertRowId)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    @@ -484,29 +498,34 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    @@ -570,25 +589,29 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -671,46 +694,48 @@ The sorting order of the selected rows.
    It is an SQL ORDER BY cla
    -

    Code example:

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

    Code example:

    +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);
    - }
    -
    - 
    +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); +} +
    @@ -811,25 +836,29 @@ The sorting order of the selected rows.
    It is an SQL ORDER BY cla
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -900,25 +929,29 @@ The sorting order of the selected rows.
    It is an SQL ORDER BY cla
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -985,25 +1018,29 @@ The sorting order of the selected rows.
    It is an SQL ORDER BY cla
    -

    Code example:

     function getValueSuccessCB(result, id)
    - {
    -     console.log(result.length + ":" + result[0]);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -1078,25 +1115,29 @@ The sorting order of the selected rows.
    It is an SQL ORDER BY cla
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/datasync.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/datasync.html index 76870f4..f01cdfd 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/datasync.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/datasync.html @@ -782,18 +782,19 @@ The profile ID is provided when the profile is successfully added.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -845,13 +846,14 @@ The profile ID is provided when the profile is successfully added.
    -

    Code example:

     // Retrieves and updates a profile
    - var profile = tizen.datasync.get(profileId);
    +

    Code example:

    +/* Retrieves and updates a profile */
    +var profile = tizen.datasync.get(profileId);
     
    - profile.profileName = "newProfileName";
    +profile.profileName = "newProfileName";
     
    - tizen.datasync.update(profile);
    - 
    +tizen.datasync.update(profile); +
    @@ -903,9 +905,10 @@ The profile ID is provided when the profile is successfully added.
    -

    Code example:

     // Removes a profile
    - tizen.datasync.remove(profileId);
    - 
    +

    Code example:

    +/* Removes a profile */
    +tizen.datasync.remove(profileId);
    +
    @@ -947,9 +950,10 @@ Normally the platform sets a limitation on the number of supported profiles. It
    -

    Code example:

     // Gets the maximum number of supported profiles on the platform
    - var numMaxProfiles = tizen.datasync.getMaxProfilesNum();
    - 
    +

    Code example:

    +/* Gets the maximum number of supported profiles on the platform */
    +var numMaxProfiles = tizen.datasync.getMaxProfilesNum();
    +
    @@ -990,9 +994,10 @@ Normally the platform sets a limitation on the number of supported profiles. It
    -

    Code example:

     // Gets the present number of profiles on the device
    - var numProfiles = tizen.datasync.getProfilesNum();
    - 
    +

    Code example:

    +/* Gets the present number of profiles on the device */
    +var numProfiles = tizen.datasync.getProfilesNum();
    +
    @@ -1053,9 +1058,10 @@ The attempt to retrieve SyncProfileInfo doesn't get any confidential in
    -

    Code example:

     // Gets the profile information with the given ID
    - var profile = tizen.datasync.get(profileId);
    - 
    +

    Code example:

    +/* Gets the profile information with the given ID */
    +var profile = tizen.datasync.get(profileId);
    +
    @@ -1101,9 +1107,10 @@ An attempt to retrieve SyncProfileInfo doesn't get any confidential inf
    -

    Code example:

     // Gets all the profile information
    - var profiles = tizen.datasync.getAll();
    - 
    +

    Code example:

    +/* Gets all the profile information */
    +var profiles = tizen.datasync.getAll();
    +
    @@ -1167,19 +1174,23 @@ If the sync mode is set to MANUAL, the synchronization does not start a
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1231,10 +1242,11 @@ If the sync mode is set to MANUAL, the synchronization does not start a
    -

    Code example:

     var profileId; //profileId obtained from SyncProfileInfo
    - // Stops the ongoing sync operation
    - tizen.datasync.stopSync(profileId);
    - 
    +

    Code example:

    +var profileId; /* profileId obtained from SyncProfileInfo */
    +/* Stops the ongoing sync operation */
    +tizen.datasync.stopSync(profileId);
    +
    @@ -1290,10 +1302,11 @@ If the sync mode is set to MANUAL, the synchronization does not start a
    -

    Code example:

     var profileId; //profileId obtained from SyncProfileInfo
    - // Gets the sync statistics information with the given ID
    - var statistics = tizen.datasync.getLastSyncStatistics(profileId);
    - 
    +

    Code example:

    +var profileId; /* profileId obtained from SyncProfileInfo */
    +/* Gets the sync statistics information with the given ID */
    +var statistics = tizen.datasync.getLastSyncStatistics(profileId);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/download.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/download.html index 70b8bc2..bd156e4 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/download.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/download.html @@ -279,11 +279,12 @@ The default value is an empty object. 2.1

    -

    Code example:

     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";
    - 
    +

    Code example:

    +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";
    +
    @@ -384,47 +385,59 @@ If the network is not available for downloading, the return value is -1 since Ti
    -

    Code example:

     // 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;
    - }
    +

    Code example:

    +/* 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");
     
    - 
    +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."); +} +
    @@ -468,9 +481,10 @@ If the network is not available for downloading, the return value is -1 since Ti
    -

    Code example:

     // Cancels the ongoing download operation with the specified ID.
    - tizen.download.cancel(downloadId);
    - 
    +

    Code example:

    +/* Cancels the ongoing download operation with the specified ID */
    +tizen.download.cancel(downloadId);
    +
    @@ -515,9 +529,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Pauses the ongoing download operation with the specified ID.
    - tizen.download.pause(downloadId);
    - 
    +

    Code example:

    +/* Pauses the ongoing download operation with the specified ID */
    +tizen.download.pause(downloadId);
    +
    @@ -561,9 +576,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Resumes the paused download operation with the specified ID.
    - tizen.download.resume(downloadId);
    - 
    +

    Code example:

    +/* Resumes the paused download operation with the specified ID */
    +tizen.download.resume(downloadId);
    +
    @@ -611,9 +627,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Gets the state of the download operation with the given ID.
    - var state = tizen.download.getState(downloadId);
    - 
    +

    Code example:

    +/* Gets the state of the download operation with the given ID */
    +var state = tizen.download.getState(downloadId);
    +
    @@ -664,9 +681,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Gets the download request information with the given ID.
    - var downloadRequest = tizen.download.getDownloadRequest(downloadId);
    - 
    +

    Code example:

    +/* Gets the download request information with the given ID */
    +var downloadRequest = tizen.download.getDownloadRequest(downloadId);
    +
    @@ -721,9 +739,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Get the MIME type of the download operation with the given ID.
    - var MIMEtype = tizen.download.getMIMEType(downloadId);
    - 
    +

    Code example:

    +/* Get the MIME type of the download operation with the given ID */
    +var MIMEtype = tizen.download.getMIMEType(downloadId);
    +
    @@ -775,31 +794,38 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    - 
    +/* Add the listener */ +tizen.download.setListener(downloadId, listener); +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/exif.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/exif.html index 0ad7642..ec9cc0a 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/exif.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/exif.html @@ -250,27 +250,33 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -324,41 +330,47 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -419,33 +431,39 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    - 
    +

    Code example:

    +/* 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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/feedback.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/feedback.html index ccbd8a7..261ab8a 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/feedback.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/feedback.html @@ -320,12 +320,16 @@ If this method is called without the type value, patterns are
    -

    Code example:

     try {
    -     tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
    - } catch (err) {
    -     console.log (err.name +': ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
    +}
    +catch (err)
    +{
    +   console.log(err.name + ': ' + err.message);
    +}
    +
    @@ -357,13 +361,17 @@ This function can be used to stop various types of vibration reactions that are
    -

    Code example:

     try {
    -     tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
    -     tizen.feedback.stop();
    - } catch (err) {
    -     console.log (err.name +': ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
    +   tizen.feedback.stop();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ': ' + err.message);
    +}
    +
    @@ -409,14 +417,16 @@ This function can be used to stop various types of vibration reactions that are
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +

    Output example:

     pattern BT_CONNECTED is supported
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/filesystem.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/filesystem.html
    index cc19a3a..eb2608f 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/filesystem.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/filesystem.html
    @@ -357,41 +357,44 @@ as determining root and default locations, resolving a given location into a fil
               

    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +

    Attributes

    @@ -405,8 +408,9 @@ as determining root and default locations, resolving a given location into a fil 1.0

    -

    Code example:

     console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
    - 
    +

    Code example:

    +console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
    +
    @@ -520,15 +524,15 @@ UnknownError - If any other error occurs.
    -

    Code example:

     tizen.filesystem.resolve(
    -   'images',
    -   function(dir) {
    -     console.log("Mount point Name is " +  dir.path);
    -   }, function(e) {
    -     console.log("Error: " + e.message);
    -   }, "r"
    - );
    - 
    +

    Code example:

    +tizen.filesystem.resolve('images', function(dir)
    +{
    +   console.log("Mount point Name is " +  dir.path);
    +}, function(e)
    +{
    +   console.log("Error: " + e.message);
    +}, "r");
    +
    @@ -598,16 +602,19 @@ UnknownError - If any other error occurs.
    -

    Code example:

     function onStorage(storage) {
    -     // Do something
    - }
    +

    Code example:

    +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);
    - 
    +tizen.filesystem.getStorage("music", onStorage, onStorageError); +
    @@ -676,17 +683,20 @@ UnknownError - If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -754,14 +764,16 @@ The watch operation must continue until the removeStorageStateChangeListener() m
    -

    Code example:

     var watchID;
    - function onStorageStateChanged(storage) {
    -     if (storage.state == "MOUNTED")
    -         console.log("Storage " + storage.label + " was added!");
    - }
    +

    Code example:

    +var watchID;
    +function onStorageStateChanged(storage)
    +{
    +   if (storage.state == "MOUNTED")
    +      console.log("Storage " + storage.label + " was added!");
    +}
     
    - watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
    - 
    +watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged); +
    @@ -813,16 +825,17 @@ Otherwise, the method call has no effect.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -986,21 +999,25 @@ files and directories rooted as the file handle location.

    -

    Code example:

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

    Code example:

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

    Attributes

    @@ -1020,23 +1037,29 @@ This attribute is set tonull if there is no parent directory. This al 1.0

    -

    Code example:

     // 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");
    - }
    - 
    +

    Code example:

    +/* 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");
    +}
    +
  • @@ -1063,22 +1086,26 @@ This attribute represents the actual state of a file or directory in the filesys 1.0

    -

    Code example:

     // 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");
    - }
    - 
    +

    Code example:

    +/* 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");
    +}
    +
  • @@ -1168,8 +1195,7 @@ timestamp changes when a file is moved. 1.0

    -

    Code example:

     console.log(file.modified); // displays the modification timestamp
    - 
    +

    Code example:

    console.log(file.modified); /* Displays the modification timestamp */
  • @@ -1203,8 +1229,7 @@ For example, if the root is music, then the path is music. If the root is docume 1.0

    -

    Code example:

     console.log(file.path); // should be 'music/' if the file is music/foo.mp3
    - 
    +

    Code example:

    console.log(file.path); /* Must be 'music/' if the file is music/foo.mp3 */
  • @@ -1233,9 +1258,10 @@ For the special case of the root itself, the name is an empty string. 1.0

    -

    Code example:

     // should be foo.mp3 if the file path is music/foo.mp3
    - console.log(file.name);
    - 
    +

    Code example:

    +/* Must be foo.mp3 if the file path is music/foo.mp3 */
    +console.log(file.name);
    +
  • @@ -1266,9 +1292,10 @@ The fullPath is always equal to path + name. 1.0

    -

    Code example:

      // should be music/track1.mp3 if the file is music/track1.mp3
    - console.log(file.fullPath);
    - 
    +

    Code example:

    +/* Must be music/track1.mp3 if the file is music/track1.mp3 */
    +console.log(file.fullPath);
    +
  • @@ -1286,9 +1313,10 @@ If an attempt to read this attribute for a directory is made, undefined
    -

    Code example:

     // displays the file size
    - console.log(file.fileSize);
    - 
    +

    Code example:

    +/* Displays the file size */
    +console.log(file.fileSize);
    +
  • @@ -1306,9 +1334,10 @@ If an attempt to read this attribute for a file is made, undefined is 1.0

    -

    Code example:

     // '3' if the directory contains two files and one sub-directory
    - console.log(file.length);
    - 
    +

    Code example:

    +/* '3' if the directory contains two files and one sub-directory */
    +console.log(file.length);
    +
  • @@ -1367,12 +1396,14 @@ These URIs must not be accessible to other widgets, apart from the one invoking
    -

    Code example:

     tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file) {
    -   var audio = new Audio(file.toURI());
    -   audio.play();
    -   console.log(file.toURI());
    - });
    - 
    +

    Code example:

    +tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
    +{
    +   var audio = new Audio(file.toURI());
    +   audio.play();
    +   console.log(file.toURI());
    +});
    +
    @@ -1448,23 +1479,25 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1537,39 +1570,43 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1639,35 +1676,40 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1754,33 +1796,36 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1867,33 +1912,36 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1970,10 +2018,11 @@ The new File object has "rw" access rights, as it inherits this from th
    -

    Code example:

     var dir; //Directory object obtained from filesystem API
    - var newDir = dir.createDirectory("newDir");
    - var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
    - 
    +

    Code example:

    +var dir; /* Directory object obtained from filesystem API */
    +var newDir = dir.createDirectory("newDir");
    +var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
    +
    @@ -2045,8 +2094,7 @@ called.
    -

    Code example:

     var newFile = dir.createFile("newFilePath");
    - 
    +

    Code example:

    var newFile = dir.createFile("newFilePath");
    @@ -2117,15 +2165,20 @@ The new File object inherits its access rights from the File o
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +
    @@ -2208,36 +2261,39 @@ all data in all subdirectories and so needs to be used with caution.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -2309,35 +2365,39 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -2528,10 +2588,12 @@ If set to false, this attribute indicates that the file pointer is no 1.0

    -

    Code example:

     if (stream.eof) {
    -   // file has been read completely
    - }
    - 
    +

    Code example:

    +if (stream.eof)
    +{
    +   /* File has been read completely */
    +}
    +
  • @@ -2548,11 +2610,14 @@ The stream position is an offset of bytes from the start of the file stream. Whe 1.0

    -

    Code example:

     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;
    - 
    +

    Code example:

    +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;
    +
  • @@ -2574,8 +2639,8 @@ It corresponds to the number of bytes available after the file pointer denoted b 1.0

    -

    Code example:

     console.log(stream.bytesAvailable); // displays the available bytes to be read
    - 
    +

    Code example:

    +console.log(stream.bytesAvailable); /* Displays the available bytes to be read */
  • @@ -2611,8 +2676,9 @@ Note that pending writes might not succeed. http://tizen.org/privilege/filesystem.read

    -

    Code example:

     stream.close(); // closes this stream, no subsequent access to stream allowed
    - 
    +

    Code example:

    +stream.close(); /* Closes this stream, no subsequent access to stream allowed */
    +
    @@ -2669,9 +2735,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     var text = stream.read(file.fileSize);
    - stream.close();
    - 
    +

    Code example:

    +var text = stream.read(file.fileSize);
    +stream.close();
    +
    @@ -2727,12 +2794,14 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     // 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
    - }
    - 
    +

    Code example:

    +/* 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 */
    +}
    +
    @@ -2768,9 +2837,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     // reads up to 256 bytes from the stream
    - var base64 = stream.readBase64(256);
    - 
    +

    Code example:

    +/* Reads up to 256 bytes from the stream */
    +var base64 = stream.readBase64(256);
    +
    @@ -2819,9 +2889,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     var text = "Hello world";
    - stream.write(text);
    - 
    +

    Code example:

    +var text = "Hello world";
    +stream.write(text);
    +
    @@ -2871,10 +2942,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var bytes = in.readBytes(256);
    - // writes the bytes read from in to out
    - out.writeBytes(bytes);
    - 
    +

    Code example:

    +var bytes = in.readBytes(256);
    +/* Writes the bytes read from in to out */
    +out.writeBytes(bytes);
    +
    @@ -2924,10 +2996,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var base64 = in.readBase64(256);
    - // writes the base64 data read from in to out
    - out.writeBase64(base64);
    - 
    +

    Code example:

    +var base64 = in.readBase64(256);
    +/* Writes the base64 data read from in to out */
    +out.writeBase64(base64);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/fmradio.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/fmradio.html index fa28caf..c765a02 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/fmradio.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/fmradio.html @@ -260,10 +260,12 @@ For example, an earphone cable is commonly used as a FM antenna in mobile phones 2.3

    -

    Code example:

     if (!tizen.fmradio.isAntennaConnected) {
    -    console.log("Please plug in the earphones to listen to the radio");
    - }
    - 
    +

    Code example:

    +if (!tizen.fmradio.isAntennaConnected)
    +{
    +   console.log("Please plug in the earphones to listen to the radio");
    +}
    +
  • @@ -330,14 +332,16 @@ If the user calls this method without any frequency value, frequencyLowerBou
  • -

    Code example:

     var radioState = tizen.fmradio.state;
    +

    Code example:

    +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);
    - 
    +if (radioState == "READY") +{ +   tizen.fmradio.start(87.5); +} +/* Jump to your favorite radio station (95.9MHz) and start playing */ +/* tizen.fmradio.start(95.9); */ +
    @@ -365,12 +369,14 @@ If the user calls this method without any frequency value, frequencyLowerBou
    -

    Code example:

     var radioState = tizen.fmradio.state;
    +

    Code example:

    +var radioState = tizen.fmradio.state;
     
    - if(radioState == "PLAYING") {
    -   tizen.fmradio.stop();
    - }
    - 
    +if (radioState == "PLAYING") +{ +   tizen.fmradio.stop(); +} +
    @@ -428,19 +434,23 @@ If a user call seekUp() while the radio is seeking, the errorCallback will be in
    -

    Code example:

     var radioState = tizen.fmradio.state;
    +

    Code example:

    +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);
    - }
    - 
    +if (radioState == "PLAYING") +{ +   tizen.fmradio.seekUp(successCallback, errorCallback); +} +
    @@ -498,19 +508,23 @@ If a user call seekDown() while the radio is seeking, the errorCallback will be
    -

    Code example:

     var radioState = tizen.fmradio.state;
    +

    Code example:

    +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);
    - }
    - 
    +if (radioState == "PLAYING") +{ +   tizen.fmradio.seekDown(successCallback, errorCallback); +} +
    @@ -575,27 +589,34 @@ UnknownError - If any other error occurs
    -

    Code example:

     var radioState = tizen.fmradio.state;
    +

    Code example:

    +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);
    - }
    - 
    +if (radioState == "READY") +{ +   tizen.fmradio.scanStart(radioScanCallback, errorCallback); +} +
    @@ -647,19 +668,23 @@ UnknownError - If any other error occurs
    -

    Code example:

     var radioState = tizen.fmradio.state;
    +

    Code example:

    +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);
    - }
    - 
    +if (radioState == "SCANNING") +{ +   tizen.fmradio.scanStop(successCallback, errorCallback); +} +
    @@ -708,16 +733,20 @@ To resume playing the radio, user interaction with the device is required. This
    -

    Code example:

     var interruptCallback = {
    -       oninterrupted: function(reason) {
    -           console.log(reason);
    -       },
    -       oninterruptfinished: function() {
    -           console.log("The radio interruption finished.");
    -       }
    - };
    - tizen.fmradio.setFMRadioInterruptedListener(interruptCallback);
    - 
    +

    Code example:

    +var interruptCallback =
    +{
    +   oninterrupted: function(reason)
    +   {
    +      console.log(reason);
    +   },
    +   oninterruptfinished: function()
    +   {
    +      console.log("The radio interruption finished.");
    +   }
    +};
    +tizen.fmradio.setFMRadioInterruptedListener(interruptCallback);
    +
    @@ -741,8 +770,9 @@ To resume playing the radio, user interaction with the device is required. This
    -

    Code example:

     tizen.fmradio.unsetFMRadioInterruptListener();
    - 
    +

    Code example:

    +tizen.fmradio.unsetFMRadioInterruptListener();
    +
    @@ -777,11 +807,13 @@ To resume playing the radio, user interaction with the device is required. This
    -

    Code example:

     function antennaCallback(isAntennaConnected) {
    -    alert("Antenna status has been changed. It is now " + (isAntennaConnected ? "connected" : "disconnected"));
    - }
    - tizen.fmradio.setAntennaChangeListener(antennaCallback);
    - 
    +

    Code example:

    +function antennaCallback(isAntennaConnected)
    +{
    +   alert("Antenna status has been changed. It is now " + (isAntennaConnected ? "connected" : "disconnected"));
    +}
    +tizen.fmradio.setAntennaChangeListener(antennaCallback);
    +
    @@ -805,9 +837,10 @@ To resume playing the radio, user interaction with the device is required. This
    -

    Code example:

     // When you don't want to detect a change in the antenna status
    - tizen.fmradio.unsetAntennaChangeListener();
    - 
    +

    Code example:

    +/* When you don't want to detect a change in the antenna status */
    +tizen.fmradio.unsetAntennaChangeListener();
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html index 6234658..b1e273e 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html @@ -284,17 +284,19 @@ UNKNOWN - Sleep status could not be determined
    -

    Code example:

     function onchangedCB(sleepInfo) {
    -     console.log("Sleep status : " + sleepInfo.status);
    -     console.log("Timestamp : " + sleepInfo.timestamp);
    - }
    -
    - tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
    - 
    +

    Code example:

    +function onchangedCB(sleepInfo)
    +{
    +   console.log("Sleep status: " + sleepInfo.status);
    +   console.log("Timestamp: " + sleepInfo.timestamp);
    +}
    +
    +tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
    +
    -

    Output example:

     Sleep status : ASLEEP
    - Timestamp : 1456735296123
    +

    Output example:

     Sleep status: ASLEEP
    + Timestamp: 1456735296123
      
    @@ -420,28 +422,32 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

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

    Code example:

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

    Output example:

     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
      
    @@ -535,38 +541,47 @@ For other types, only 'http://tizen.org/privilege/healthinfo' should be d
    -

    Code example:

     function onchangedCB(pedometerInfo) {
    -     console.log("Step status : " + pedometerInfo.stepStatus);
    -     console.log("Cumulative total step count : " + pedometerInfo.cumulativeTotalStepCount);
    - }
    -
    - tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
    - 
    +

    Code example:

    +function onchangedCB(pedometerInfo)
    +{
    +   console.log("Step status: " + pedometerInfo.stepStatus);
    +   console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
    +}
    +
    +tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
    +
    -

    Output example:

     Step status : WALKING
    - Cumulative total step count : 100
    +

    Output example:

     Step status: WALKING
    + Cumulative total step count: 100
      
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -629,8 +644,9 @@ For other types, only 'http://tizen.org/privilege/healthinfo' should be d
    -

    Code example:

     tizen.humanactivitymonitor.stop("PEDOMETER");
    - 
    +

    Code example:

    +tizen.humanactivitymonitor.stop("PEDOMETER");
    +
    @@ -687,17 +703,19 @@ Note that the setAccumulativePedometerListener() method does not need to call th
    -

    Code example:

     function onchangedCB(pedometerInfo) {
    -        console.log("Step status : " + pedometerInfo.stepStatus);
    -        console.log("Accumulative total step count : " + pedometerInfo.accumulativeTotalStepCount);
    - }
    -
    - tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
    - 
    +

    Code example:

    +function onchangedCB(pedometerInfo)
    +{
    +   console.log("Step status: " + pedometerInfo.stepStatus);
    +   console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount);
    +}
    +
    +tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
    +
    -

    Output example:

     Step status : WALKING
    - Accumulative total step count : 100
    +

    Output example:

     Step status: WALKING
    + Accumulative total step count: 100
      
    @@ -735,8 +753,8 @@ Note that the setAccumulativePedometerListener() method does not need to call th
    -

    Code example:

     tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
    - 
    +

    Code example:

    tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
    +
    @@ -795,22 +813,28 @@ The ErrorCallback method is launched with this error type:
    -

    Code example:

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

    Code example:

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

    Output example:

     type: WALKING
    @@ -855,26 +879,32 @@ The ErrorCallback method is launched with this error type:
             
     
    -

    Code example:

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

    Code example:

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

    Output example:

     type: WALKING
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/inputdevice.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/inputdevice.html
    index 41c29bf..e59d4ed 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/inputdevice.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/inputdevice.html
    @@ -215,22 +215,26 @@ Mandatory keys will not be retrieved by this method.
     
             
    -

    Code example:

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

    Code example:

    +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");
    +   }
    +});
    +
    @@ -315,15 +319,20 @@ An application can not register the mandatory keys (ArrowLeft, ArrowRight, Arrow
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +}
    +
    @@ -361,8 +370,9 @@ An application can not register the mandatory keys (ArrowLeft, ArrowRight, Arrow
    -

    Code example:

     tizen.inputdevice.unregisterKey("VolumeDown");
    - 
    +

    Code example:

    +tizen.inputdevice.unregisterKey("VolumeDown");
    +
    @@ -428,17 +438,20 @@ An application can not register the mandatory keys (ArrowLeft, ArrowRight, Arrow
    -

    Code example:

     function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +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);
    - 
    +var keys = ["VolumeUp", "VolumeDown"]; +tizen.inputdevice.registerKeyBatch(keys, successCB, errorCB); +
    @@ -498,16 +511,20 @@ UnknownError: In case of any other error
    -

    Code example:

     function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +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);
    - 
    +var keys = ["VolumeUp", "VolumeDown"]; +tizen.inputdevice.unregisterKeyBatch(keys, successCB, errorCB); +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/keymanager.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/keymanager.html index b8931f0..c08e2ef 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/keymanager.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/keymanager.html @@ -214,14 +214,16 @@ UnknownError - If the method cannot be completed because of an unknown error.
    -

    Code example:

     var data_name = "data1", raw_data = "my data";
    +

    Code example:

    +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);
    - 
    +tizen.keymanager.saveData(data_name, raw_data, null, onSave); +
    @@ -270,31 +272,36 @@ If an application calls this method to remove data which it saved into the KeyMa
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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]);
    +}
    +
    @@ -354,30 +361,36 @@ If an application calls this method to retrieve raw data which it saved into the
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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");
    +}
    +
    @@ -405,14 +418,16 @@ If an application calls this method to retrieve raw data which it saved into the
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -475,41 +490,53 @@ UnknownError - If the method cannot be completed because of an unknown error.
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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");
    +   }
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/mediacontroller.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/mediacontroller.html index 59914d0..b621c25 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/mediacontroller.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/mediacontroller.html @@ -264,12 +264,16 @@ There is a tizen.mediacontroller object that allows access to the Media
    -

    Code example:

     try {
    -     var mcClient = tizen.mediacontroller.getClient();
    - } catch (err) {
    -     console.log (err.name +': ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var mcClient = tizen.mediacontroller.getClient();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ': ' + err.message);
    +}
    +
    @@ -314,12 +318,16 @@ and is controlled by Client.
    -

    Code example:

     try {
    -     var mcServer = tizen.mediacontroller.createServer();
    - } catch (err) {
    -     console.log (err.name +': ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var mcServer = tizen.mediacontroller.createServer();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ': ' + err.message);
    +}
    +
    @@ -419,11 +427,12 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +var mcServer = tizen.mediacontroller.createServer();
     
    - mcServer.updatePlaybackState('PLAY');
    - console.log('Current playback state is: ' + mcServer.playbackInfo.state);
    - 
    +mcServer.updatePlaybackState('PLAY'); +console.log('Current playback state is: ' + mcServer.playbackInfo.state); +
    @@ -461,11 +470,12 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +var mcServer = tizen.mediacontroller.createServer();
     
    - mcServer.updatePlaybackPosition(164);
    - console.log('Current playback position is: ' + mcServer.playbackInfo.position);
    - 
    +mcServer.updatePlaybackPosition(164); +console.log('Current playback position is: ' + mcServer.playbackInfo.position); +
    @@ -498,11 +508,12 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +var mcServer = tizen.mediacontroller.createServer();
     
    - mcServer.updateShuffleMode(true);
    - console.log('Current shuffle mode is: ' + mcServer.playbackInfo.shuffleMode);
    - 
    +mcServer.updateShuffleMode(true); +console.log('Current shuffle mode is: ' + mcServer.playbackInfo.shuffleMode); +
    @@ -535,11 +546,12 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +var mcServer = tizen.mediacontroller.createServer();
     
    - mcServer.updateRepeatMode(true);
    - console.log('Current repeat mode is: ' + mcServer.playbackInfo.repeatMode);
    - 
    +mcServer.updateRepeatMode(true); +console.log('Current repeat mode is: ' + mcServer.playbackInfo.repeatMode); +
    @@ -577,14 +589,15 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    - var metadata = mcServer.playbackInfo.metadata;
    +

    Code example:

    +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));
    - 
    +console.log('Current metadata is: ' + JSON.stringify(mcServer.playbackInfo.metadata)); +
    @@ -628,27 +641,33 @@ requests from client.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -681,30 +700,36 @@ requests from client.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -747,23 +772,23 @@ See MediaControllerServerInfo to check how to send custom commands from
    -

    Code example:

     var watcherId = 0; // watcher identifier
    - var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +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); +
    @@ -796,26 +821,26 @@ See MediaControllerServerInfo to check how to send custom commands from
    -

    Code example:

     var watcherId = 0; // watcher identifier
    - var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +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);
    - 
    +/* Cancels the watch operation */ +mcServer.removeCommandListener(watcherId); +
    @@ -907,12 +932,13 @@ Functions include operations to get the latest status of the media controller se
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -1043,15 +1069,18 @@ Provides methods to send commands to server and listen for server status change.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1100,15 +1129,18 @@ Provides methods to send commands to server and listen for server status change.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1154,15 +1186,18 @@ Provides methods to send commands to server and listen for server status change.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1208,15 +1243,18 @@ Provides methods to send commands to server and listen for server status change.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1270,18 +1308,20 @@ and respond to custom commands.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1323,15 +1363,17 @@ and respond to custom commands.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1364,18 +1406,20 @@ and respond to custom commands.
    -

    Code example:

     var watcherId = 0; // watcher identifier
    - var mcClient = tizen.mediacontroller.getClient();
    - var mcServerInfo = mcClient.getLatestServerInfo();
    +

    Code example:

    +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);
    - 
    +/* Cancels the watch operation */ +mcServerInfo.removeServerStatusChangeListener(watcherId); +
    @@ -1417,29 +1461,35 @@ and respond to custom commands.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1472,33 +1522,39 @@ and respond to custom commands.
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/mediakey.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/mediakey.html index 4669aee..3b90ca2 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/mediakey.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/mediakey.html @@ -184,15 +184,19 @@ There is a tizen.mediakey object that allows accessing the functionality of the
    -

    Code example:

     tizen.mediakey.setMediaKeyEventListener({
    -     onpressed: function(key) {
    -         console.log("Pressed  key: " + key);
    -     },
    -     onreleased: function(key) {
    -         console.log("Released key: " + key);
    -     }
    - });
    - 
    +

    Code example:

    +tizen.mediakey.setMediaKeyEventListener(
    +{
    +   onpressed: function(key)
    +   {
    +      console.log("Pressed key: " + key);
    +   },
    +   onreleased: function(key)
    +   {
    +      console.log("Released key: " + key);
    +   }
    +});
    +
    @@ -216,8 +220,9 @@ There is a tizen.mediakey object that allows accessing the functionality of the
    -

    Code example:

     tizen.mediakey.unsetMediaKeyEventListener();
    - 
    +

    Code example:

    +tizen.mediakey.unsetMediaKeyEventListener();
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/messageport.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/messageport.html index d169f41..6fa7644 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/messageport.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/messageport.html @@ -229,9 +229,10 @@ The tizen.messageport object allows access to the functionality of the
    -

    Code example:

     // Requests the LocalMessagePort instance with the specified message port name
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - 
    +

    Code example:

    +/* Requests the LocalMessagePort instance with the specified message port name */
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +
    @@ -281,9 +282,10 @@ Trusted local message port can communicate with applications that are signed wit
    -

    Code example:

     // Requests the LocalMessagePort instance with the specified message port name
    - var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
    - 
    +

    Code example:

    +/* Requests the LocalMessagePort instance with the specified message port name */
    +var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
    +
    @@ -334,9 +336,10 @@ If the message port name and application ID are the same, the platform returns t
    -

    Code example:

     // Requests the RemoteMessagePort instance with the specified message port name
    - var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
    - 
    +

    Code example:

    +/* Requests the RemoteMessagePort instance with the specified message port name */
    +var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
    +
    @@ -391,9 +394,10 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     // Requests the RemoteMessagePort instance with the specified message port name.
    - var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
    - 
    +

    Code example:

    +/* Requests the RemoteMessagePort instance with the specified message port name */
    +var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
    +
    @@ -488,13 +492,15 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     function onreceived(data, remoteMsgPort) {
    -   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    - }
    +

    Code example:

    +function onreceived(data, remoteMsgPort)
    +{
    +   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    +}
     
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - 
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA'); +var watchId = localMsgPort.addMessagePortListener(onreceived); +
    @@ -538,11 +544,13 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - // Communication routines of your app...
    - localMsgPort.removeMessagePortListener(watchId);
    - 
    +

    Code example:

    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +var watchId = localMsgPort.addMessagePortListener(onreceived);
    +/* Communication routines of your app */
    +
    +localMsgPort.removeMessagePortListener(watchId);
    +
    @@ -656,30 +664,34 @@ array must not be duplicated or empty.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -755,14 +767,16 @@ array must not be duplicated or empty.
    -

    Code example:

     // MessagePortCallback instance
    - function onreceived(data, remoteMsgPort) {
    -   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    - }
    -
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - 
    +

    Code example:

    +/* MessagePortCallback instance */
    +function onreceived(data, remoteMsgPort)
    +{
    +   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    +}
    +
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +var watchId = localMsgPort.addMessagePortListener(onreceived);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/messaging.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/messaging.html index 3907d10..838beb3 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/messaging.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/messaging.html @@ -361,27 +361,30 @@ of a message without the loaded body. In such situations, the method Message

    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +

    Constructors

    @@ -667,18 +670,20 @@ This array is empty if the message does not have attachments or the message body 1.0

    -

    Code example:

     // 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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -927,18 +932,20 @@ This property is used only with email messages. 1.0

    -

    Code example:

     // 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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -1062,21 +1069,25 @@ for concrete account.

    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +

    Methods

    @@ -1137,19 +1148,22 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -1254,36 +1268,40 @@ The interface allows fetching of the message body for a given message using load

    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +

    Attributes

    @@ -1432,44 +1450,50 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    -

    Code example:

     // **********************************************************************************
    +

    Code example:

    + // **********************************************************************************
      // *  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.");
     
    - 
    +/* To send a message via the last SIM */ +services[0].sendMessage(msg, messageSent, messageFailed, count); +
    @@ -1542,28 +1566,34 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -1635,28 +1665,34 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -1734,18 +1770,21 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // Defines the success callback.
    - function serviceSynced() {
    +

    Code example:

    +/* 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);
    - 
    + /* Subscribes to MessageStorage notification */ +} +tizen.messaging.getMessageServices("messaging.email", servicesListSuccessCB); +
    @@ -1846,31 +1885,37 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2174,27 +2219,31 @@ is not compatible with the expected type for that parameter or if the method is
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -2275,23 +2324,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2360,29 +2413,36 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -2455,32 +2515,38 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2561,23 +2627,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2646,37 +2716,44 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2745,17 +2822,20 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2824,19 +2904,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2905,19 +2993,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2986,19 +3082,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3064,24 +3168,31 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/networkbearerselection.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/networkbearerselection.html index 8af62db..156b827 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/networkbearerselection.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/networkbearerselection.html @@ -226,13 +226,16 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -321,17 +324,20 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/nfc.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/nfc.html index ca5d56e..2ed80b5 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/nfc.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/nfc.html @@ -559,12 +559,16 @@ It provides access to the API functionalities through the tizen.nfc interface.
    -

    Code example:

     try {
    -     var adapter = tizen.nfc.getDefaultAdapter();
    - } catch (err) {
    -     console.log(err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var adapter = tizen.nfc.getDefaultAdapter();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -624,12 +628,16 @@ The exclusive mode can only be set when NFC is on. If NFC is off, the mode is ig
    -

    Code example:

     try {
    -   tizen.nfc.setExclusiveMode(true) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.nfc.setExclusiveMode(true);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -892,33 +900,43 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -990,14 +1008,21 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1062,14 +1087,21 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1115,24 +1147,28 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    - 
    +/* Registers to be notified when NFC tag is detected */ +adapter.setTagListener(onSuccessCB); +
    @@ -1178,24 +1214,28 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    - 
    +/* Registers to be notified when NFC peer target is detected */ +adapter.setPeerListener(onSuccessCB); +
    @@ -1251,15 +1291,20 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1308,12 +1353,16 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     try {
    -   adapter.removeCardEmulationModeChangeListener(listenerId) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.removeCardEmulationModeChangeListener(listenerId);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1374,12 +1423,16 @@ Such an event may indicate initiating a financial transaction using the device.
    -

    Code example:

     try {
    -   var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data){console.log("transaction event occurs");}) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data) {console.log("transaction event occurs");});
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1428,12 +1481,16 @@ Such an event may indicate initiating a financial transaction using the device.
    -

    Code example:

     try {
    -   adapter.removeTransactionEventListener(listenerId) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.removeTransactionEventListener(listenerId);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1489,15 +1546,20 @@ Such an event may indicate initiating a financial transaction using the device.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1546,12 +1608,16 @@ Such an event may indicate initiating a financial transaction using the device.
    -

    Code example:

     try {
    -   adapter.removeActiveSecureElementChangeListener(listenerId) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.removeActiveSecureElementChangeListener(listenerId);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1598,9 +1664,10 @@ should be returned.
    -

    Code example:

     // Gets the cached message
    - var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
    - 
    +

    Code example:

    +/* Gets the cached message */
    +var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
    +
    @@ -1670,12 +1737,16 @@ Losing priority is always allowed regardless of an application's status.
    -

    Code example:

     try {
    -   adapter.setExclusiveModeForTransaction(true) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.setExclusiveModeForTransaction(true);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1735,16 +1806,21 @@ Losing priority is always allowed regardless of an application's status.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1793,12 +1869,16 @@ Losing priority is always allowed regardless of an application's status.
    -

    Code example:

     try {
    -   adapter.removeHCEEventListener(listenerId) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.removeHCEEventListener(listenerId);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1870,29 +1950,35 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1956,16 +2042,21 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2029,15 +2120,20 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2101,14 +2197,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     try {
    -
    -   var aid = "ABC0012345";
    -   adapter.registerAID("HCE", aid, "PAYMENT") ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var aid = "ABC0012345";
    +   adapter.registerAID("HCE", aid, "PAYMENT");
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -2172,14 +2271,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     try {
    -
    -   var aid = "ABC0012345";
    -   adapter.unregisterAID("HCE", aid, "PAYMENT") ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var aid = "ABC0012345";
    +   adapter.unregisterAID("HCE", aid, "PAYMENT");
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -2255,27 +2357,33 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2362,18 +2470,25 @@ The array's index is the pair's key and value is its value. 1.0

    -

    Code example:

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

    Code example:

    +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);
    +
  • @@ -2455,27 +2570,32 @@ is not compatible with the expected type for that parameter.
  • -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2546,26 +2666,29 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2635,25 +2758,29 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2746,21 +2873,28 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2800,21 +2934,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2882,24 +3022,30 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2926,16 +3072,20 @@ The NDEFMessage must have at least one NDEFRecord. 1.0

    -

    Code example:

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

    Code example:

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

    Constructors

    @@ -2968,18 +3118,21 @@ The NDEFMessage must have at least one NDEFRecord. 1.0

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3022,10 +3175,11 @@ If the operation completes successfully, it returns the serial byte array of the
    -

    Code example:

     // Gets the cached message.
    - var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
    - var raw = cachedMessage.toByte();
    - 
    +

    Code example:

    +/* Gets the cached message */
    +var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
    +var raw = cachedMessage.toByte();
    +
    @@ -3052,24 +3206,32 @@ If the operation completes successfully, it returns the serial byte array of the 1.0

    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

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

    Constructors

    @@ -3163,10 +3325,11 @@ The byte array contains 0 to (2 ** 32 - 1) bytes. 1.0

    -

    Code example:

     // Creates a new NDEF record.
    - var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
    - var payload = newRecord.payload;
    - 
    +

    Code example:

    +/* Creates a new NDEF record */
    +var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
    +var payload = newRecord.payload;
    +
    @@ -3227,8 +3390,9 @@ The byte array contains 0 to (2 ** 32 - 1) bytes. 1.0

    -

    Code example:

       var newRecord = new tizen.NDEFRecordText("Tizen", "en-US", "UTF8");
    - 
    +

    Code example:

    +var newRecord = new tizen.NDEFRecordText("Tizen", "en-US", "UTF8");
    +
    @@ -3264,10 +3428,11 @@ The byte array contains 0 to (2 ** 32 - 1) bytes. 1.0

    -

    Code example:

       // Creates a new NDEF record.
    -   var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
    -   var payload = newRecord.payload;
    - 
    +

    Code example:

    +/* Creates a new NDEF record */
    +var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
    +var payload = newRecord.payload;
    +
    @@ -3310,9 +3475,10 @@ The byte array contains 0 to (2 ** 32 - 1) bytes. 1.0

    -

    Code example:

       var myData = [116, 105, 122, 101, 110];
    -   var newRecord = new tizen.NDEFRecordMedia("text/plain", myData);
    - 
    +

    Code example:

    +var myData = [116, 105, 122, 101, 110];
    +var newRecord = new tizen.NDEFRecordMedia("text/plain", myData);
    +
    @@ -3481,19 +3647,25 @@ It is used in NFCAdapter.setTagListener().
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3510,23 +3682,30 @@ It is used in NFCAdapter.setTagListener(). 1.0

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3585,20 +3764,26 @@ It is used in NFCAdapter.setPeerListener().
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3615,23 +3800,30 @@ It is used in NFCAdapter.setPeerListener(). 1.0

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3683,25 +3875,32 @@ operations, such as NFCTag.readNDEF() or NFCPeer.setReceiveNDEFListener().
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3751,20 +3950,23 @@ raw data as an input parameter. It is used in NFCTag.transceive().
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3808,17 +4010,21 @@ raw data as an input parameter. It is used in NFCTag.transceive().
    -

    Code example:

     try {
    -
    -   var onSuccessCB = function(mode) {
    -     console.log("CardEmulationModeChangeCallback called successfully");
    -   };
    -
    -   var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var onSuccessCB = function(mode)
    +   {
    +      console.log("CardEmulationModeChangeCallback called successfully");
    +   };
    +
    +   var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -3866,17 +4072,21 @@ raw data as an input parameter. It is used in NFCTag.transceive().
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -3920,17 +4130,21 @@ raw data as an input parameter. It is used in NFCTag.transceive().
    -

    Code example:

     try {
    -
    -   var onSuccessCB = function(seType) {
    -     console.log("ActiveSecureElementChangeCallback called successfully");
    -   };
    -
    -   var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var onSuccessCB = function(seType)
    +   {
    +      console.log("ActiveSecureElementChangeCallback called successfully");
    +   };
    +
    +   var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -3974,17 +4188,21 @@ raw data as an input parameter. It is used in NFCTag.transceive().
    -

    Code example:

     try {
    -
    -   var onDetectedCB = function(event_data) {
    -     console.log("HCEEventReceiveCallback called successfully");
    -   };
    -
    -   var listenerId = adapter.addHCEEventListener(onDetectedCB) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var onDetectedCB = function(event_data)
    +   {
    +      console.log("HCEEventReceiveCallback called successfully");
    +   };
    +
    +   var listenerId = adapter.addHCEEventListener(onDetectedCB);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -4028,17 +4246,21 @@ raw data as an input parameter. It is used in NFCTag.transceive().
    -

    Code example:

     try {
    -
    -   var successCB = function(aids) {
    -     console.log("AIDArraySuccessCallback called successfully");
    -   };
    -
    -   adapter.getAIDsForCategory("HCE", "PAYMENT", successCB) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var successCB = function(aids)
    +   {
    +      console.log("AIDArraySuccessCallback called successfully");
    +   };
    +
    +   adapter.getAIDsForCategory("HCE", "PAYMENT", successCB);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/notification.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/notification.html index 42abb33..6144326 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/notification.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/notification.html @@ -309,27 +309,29 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -382,14 +384,18 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -441,13 +447,17 @@ parameters contain an invalid value.
    -

    Code example:

     try {
    -      // Uses a variable for the previously posted notification.
    -      tizen.notification.remove(notification.id);
    - } catch (err) {
    -      console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   /* Uses a variable for the previously posted notification */
    +   tizen.notification.remove(notification.id);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -484,12 +494,16 @@ parameters contain an invalid value.
    -

    Code example:

     try {
    -      tizen.notification.removeAll();
    - } catch (err) {
    -      console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.notification.removeAll();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -526,16 +540,20 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -558,27 +576,31 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -649,12 +671,16 @@ is not given (in this case alpha is assumed to have value 0xff). In this case on
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -691,15 +717,20 @@ is not given (in this case alpha is assumed to have value 0xff). In this case on
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -932,24 +963,29 @@ This method has effects when the device has notification LED. 2.2

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
  • @@ -1031,26 +1067,30 @@ The maximum number of thumbnail path elements in the array is 4. 2.0

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
  • @@ -1086,35 +1126,35 @@ Range of progressValue: percent (0 to 100). 2.0

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
  • @@ -1136,8 +1176,9 @@ Range of progressValue: percent (0 to 100). 2.1

    -

    Code example:

     var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013');
    - notification.detailInfo = [detailInfo1];
    +

    Code example:

    +var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013');
    +notification.detailInfo = [detailInfo1];
     
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/package.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/package.html index 137b7f1..db1c283 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/package.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/package.html @@ -225,31 +225,34 @@ UnknownError - If it is not allowed to install the package by the platform or an
    -

    Code example:

     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");
    -
    - 
    +

    Code example:

    +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");
    +
    @@ -320,22 +323,27 @@ UnknownError - If it is not allowed to uninstall the package from the platform o
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -397,16 +405,20 @@ UnknownError - If any other platform error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -468,10 +480,11 @@ The list of installed packages and their package IDs is obtained using getPa
    -

    Code example:

     var packageInfo = tizen.package.getPackageInfo(null);
    +

    Code example:

    +var packageInfo = tizen.package.getPackageInfo(null);
     
    - console.log("Current Package ID : " + packageInfo.id);
    - 
    +console.log("Current Package ID: " + packageInfo.id); +
    @@ -528,20 +541,25 @@ The callback lasts until the unsetPackageInfoEventListener() method is
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -578,8 +596,9 @@ The callback lasts until the unsetPackageInfoEventListener() method is
    -

    Code example:

     tizen.package.unsetPackageInfoEventListener();
    - 
    +

    Code example:

    +tizen.package.unsetPackageInfoEventListener();
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/power.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/power.html index 5f8a943..e8077b7 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/power.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/power.html @@ -281,8 +281,9 @@ parameters contain an invalid value.
    -

    Code example:

     tizen.power.request("SCREEN", "SCREEN_NORMAL");
    - 
    +

    Code example:

    +tizen.power.request("SCREEN", "SCREEN_NORMAL");
    +
    @@ -328,9 +329,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Release SCREEN resource.
    - tizen.power.release("SCREEN");
    - 
    +

    Code example:

    +/* Release SCREEN resource */
    +tizen.power.release("SCREEN");
    +
    @@ -376,13 +378,15 @@ parameters contain an invalid value.
    -

    Code example:

     function onScreenStateChanged(previousState, changedState) {
    -   console.log("Screen state changed from " + previousState + " to " + changedState);
    - }
    +

    Code example:

    +function onScreenStateChanged(previousState, changedState)
    +{
    +   console.log("Screen state changed from " + previousState + " to " + changedState);
    +}
     
    - // Sets the screen state change listener.
    - tizen.power.setScreenStateChangeListener(onScreenStateChanged);
    - 
    +/* Sets the screen state change listener */ +tizen.power.setScreenStateChangeListener(onScreenStateChanged); +
    @@ -411,9 +415,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Unsets the screen state change listener.
    - tizen.power.unsetScreenStateChangeListener();
    - 
    +

    Code example:

    +/* Unsets the screen state change listener */
    +tizen.power.unsetScreenStateChangeListener();
    +
    @@ -446,9 +451,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Gets the current screen brightness value.
    - var screenBrightness = tizen.power.getScreenBrightness();
    - 
    +

    Code example:

    +/* Gets the current screen brightness value */
    +var screenBrightness = tizen.power.getScreenBrightness();
    +
    @@ -510,9 +516,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Sets the screen brightness value for the application.
    - tizen.power.setScreenBrightness(1);
    - 
    +

    Code example:

    +/* Sets the screen brightness value for the application */
    +tizen.power.setScreenBrightness(1);
    +
    @@ -545,9 +552,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Checks whether the screen is on or off.
    - var isScreenOn = tizen.power.isScreenOn();
    - 
    +

    Code example:

    +/* Checks whether the screen is on or off */
    +var isScreenOn = tizen.power.isScreenOn();
    +
    @@ -576,9 +584,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Restores the screen brightness value to the system default setting value.
    - tizen.power.restoreScreenBrightness();
    - 
    +

    Code example:

    +/* Restores the screen brightness value to the system default setting value */
    +tizen.power.restoreScreenBrightness();
    +
    @@ -626,9 +635,10 @@ This API triggers turn-on process and then updates the status when it completes.
    -

    Code example:

     // Turns the screen on.
    - tizen.power.turnScreenOn();
    - 
    +

    Code example:

    +/* Turns the screen on */
    +tizen.power.turnScreenOn();
    +
    @@ -677,9 +687,10 @@ While the operation is on-going, the isScreenOn() method returns true.
    -

    Code example:

     // Turns the screen off.
    - tizen.power.turnScreenOff();
    - 
    +

    Code example:

    +/* Turns the screen off */
    +tizen.power.turnScreenOff();
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/preference.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/preference.html index 108fdf1..1fffbda 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/preference.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/preference.html @@ -210,14 +210,17 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     var successCB = function(preferences) {
    -   if (preferences.length) {
    -     console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
    -   }
    - };
    +

    Code example:

    +var successCB = function(preferences)
    +{
    +   if (preferences.length)
    +   {
    +      console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
    +   }
    +};
     
    - tizen.preference.getAll(successCB);
    - 
    +tizen.preference.getAll(successCB); +

    Output example:

     The first preference - key: key1 value: Sample value
    @@ -263,8 +266,9 @@ The tizen.preference object provides access to the Preference service A
     
             
    -

    Code example:

     tizen.preference.setValue('key1', 'New value');
    - 
    +

    Code example:

    +tizen.preference.setValue('key1', 'New value');
    +
    @@ -309,9 +313,10 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     var currentValue = tizen.preference.getValue('key1');
    - console.log('The current value of the preference key1 is: ' + currentValue);
    - 
    +

    Code example:

    +var currentValue = tizen.preference.getValue('key1');
    +console.log('The current value of the preference key1 is: ' + currentValue);
    +

    Output example:

     The current value of the preference key1 is: New value
    @@ -356,8 +361,9 @@ The tizen.preference object provides access to the Preference service A
     
             
    -

    Code example:

     tizen.preference.remove('key1');
    - 
    +

    Code example:

    +tizen.preference.remove('key1');
    +
    @@ -386,8 +392,9 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     tizen.preference.removeAll();
    - 
    +

    Code example:

    +tizen.preference.removeAll();
    +
    @@ -429,12 +436,16 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     if (tizen.preference.exists('key1')) {
    -   console.log('Preference with the key key1 exists');
    - } else {
    -   console.log('Preference with the key key1 doesn't exist');
    - }
    - 
    +

    Code example:

    +if (tizen.preference.exists('key1'))
    +{
    +   console.log('Preference with the key key1 exists');
    +}
    +else
    +{
    +   console.log('Preference with the key key1 doesn't exist');
    +}
    +

    Output example:

     Preference with the key key1 exists
    @@ -486,12 +497,14 @@ The tizen.preference object provides access to the Preference service A
     
             
    -

    Code example:

     var listener = function(data) {
    -   console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
    - };
    +

    Code example:

    +var listener = function(data)
    +{
    +   console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
    +};
     
    - tizen.preference.setChangeListener('key1', listener);
    - 
    +tizen.preference.setChangeListener('key1', listener); +

    Output example:

     Preference with the key: key1 has a new value: Sample value
    @@ -536,12 +549,14 @@ The tizen.preference object provides access to the Preference service A
     
             
    -

    Code example:

     var listener = function(data) {
    -   tizen.preference.unsetChangeListener(data.key);
    - };
    +

    Code example:

    +var listener = function(data)
    +{
    +   tizen.preference.unsetChangeListener(data.key);
    +};
     
    - tizen.preference.setChangeListener('key1', listener);
    - 
    +tizen.preference.setChangeListener('key1', listener); +
    @@ -585,12 +600,14 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     var listener = function(data) {
    -   tizen.preference.unsetChangeListener(data.key);
    - };
    +

    Code example:

    +var listener = function(data)
    +{
    +   tizen.preference.unsetChangeListener(data.key);
    +};
     
    - tizen.preference.setChangeListener('key1', listener);
    - 
    +tizen.preference.setChangeListener('key1', listener); +
    @@ -634,14 +651,17 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     var successCB = function(preferences) {
    -   if (preferences.length) {
    -     console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
    -   }
    - };
    +

    Code example:

    +var successCB = function(preferences)
    +{
    +   if (preferences.length)
    +   {
    +      console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
    +   }
    +};
     
    - tizen.preference.getAll(successCB);
    - 
    +tizen.preference.getAll(successCB); +

    Output example:

     First preference - key: key1 value: Sample value
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/push.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/push.html
    index 095ac44..caa056e 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/push.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/push.html
    @@ -256,22 +256,25 @@ do not contain a valid value.
     
             
    -

    Code example:

     // 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");
    +

    Code example:

    +/* 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);
    - 
    +/* Requests registration */ +tizen.push.registerService(service, registerSuccessCallback, errorCallback); +
    @@ -330,19 +333,22 @@ AbortError - If the operation cannot be finished properly.
    -

    Code example:

     // Defines the error callback.
    - function errorCallback(response) {
    -   console.log("The following error occurred: " +  response.name);
    - }
    +

    Code example:

    +/* 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);
    - 
    +/* Requests application registration */ +tizen.push.register(registerSuccessCallback, errorCallback); +

    Output example:

     Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
    @@ -414,19 +420,22 @@ UnknownError - If an unknown error occurs.              
     
             
    -

    Code example:

     // Defines the error callback
    - function errorCallback(response) {
    -   console.log( 'The following error occurred: ' +  response.name);
    - }
    +

    Code example:

    +/* 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);
    - 
    +/* Requests unregistration */ +tizen.push.unregisterService(unregisterSuccessCallback, errorCallback); +
    @@ -485,19 +494,22 @@ AbortError - If the operation cannot be finished properly.
    -

    Code example:

     // Defines the error callback
    - function errorCallback(response) {
    -   console.log("The following error occurred: " +  response.name);
    - }
    +

    Code example:

    +/* 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);
    - 
    +/* Requests unregistration */ +tizen.push.unregister(unregisterSuccessCallback, errorCallback); +

    Output example:

     Unregistration succeeded.
    @@ -557,27 +569,31 @@ the register() method must be called before calling the connectServ
     
             
    -

    Code example:

     // Defines the registration error callback.
    - function errorCallback(response) {
    -   console.log("The following error occurred: " +  response.name);
    - }
    +

    Code example:

    +/* 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);
    - 
    +/* Requests for push service connection */ +tizen.push.connectService(notificationCallback); +
    @@ -614,9 +630,10 @@ the register() method must be called before calling the connectServ
    -

    Code example:

     // Requests disconnection
    - tizen.push.disconnectService();
    - 
    +

    Code example:

    +/* Requests disconnection */
    +tizen.push.disconnectService();
    +
    @@ -657,11 +674,13 @@ the register() method must be called before calling the connectServ
    -

    Code example:

     var registrationId = tizen.push.getRegistrationId();
    - if ( registrationId != null ) {
    -   console.log("The registration id: " + registrationId);
    - }
    - 
    +

    Code example:

    +var registrationId = tizen.push.getRegistrationId();
    +if (registrationId != null)
    +{
    +   console.log("The registration id: " + registrationId);
    +}
    +
    @@ -715,16 +734,17 @@ Once a missed push notification is retrieved the server deletes it from its data
    -

    Code example:

     // Defines the connect success callback
    - function notificationCallback(message) {
    -     console.log("New push message : " + message.alertMessage + ", date : " + message.date + ", data : " + message.appData);
    -   }
    - }
    +

    Code example:

    +/* 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();
    - 
    +/* Requests for push service connection */ +tizen.push.connectService(notificationCallback); +tizen.push.getUnreadNotifications(); +
    @@ -775,13 +795,17 @@ If the application was not launched by the push service, this method returns
    -

    Code example:

     try {
    -   var message = tizen.push.getPushMessage();
    -   console.log('Message received from: ' + message.sender);
    - } catch (err) {
    -   console.log('Exception - code: ' + err.name + ' message: ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var message = tizen.push.getPushMessage();
    +   console.log('Message received from: ' + message.sender);
    +}
    +catch (err)
    +{
    +   console.log('Exception - code: ' + err.name + ' message: ' + err.message);
    +}
    +

    Output example:

     Message received from: xyz.AnotherApp
    @@ -905,21 +929,23 @@ This data is the message that the sender wants to send and its length must be le
      3.0
                 

    -

    Code example:

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

    Code example:

    +/* 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);
    - 
    +/* Requests for push service connection */ +tizen.push.connectService(notificationCallback); +

    Output example:

     Notification received on Thu Jan 01 2015 from: xyz.AnotherApp
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/se.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/se.html
    index 3dfc434..57c4f2b 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/se.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/se.html
    @@ -225,22 +225,30 @@ The ErrorCallback is launched with these error types:
     
             
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -293,24 +301,32 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    - }
    - 
    +try +{ +   var seListener = tizen.seService.registerSEListener(listener); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -356,13 +372,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     var seListener; //seListener obtained from registerSEListener
    - try {
    -  tizen.seService.unregisterSEListener(seListener);
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var seListener; /* seListener obtained from registerSEListener */
    +try
    +{
    +   tizen.seService.unregisterSEListener(seListener);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -399,12 +419,16 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     try {
    -  tizen.seService.shutdown();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.seService.shutdown();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -485,22 +509,30 @@ This interface offers methods to control sessions on the reader.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -563,18 +595,24 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -611,12 +649,16 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     try {
    -  reader.closeSessions();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   reader.closeSessions();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -736,31 +778,42 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    - }
    - 
    +   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); +} +
    @@ -840,25 +893,34 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    - }
    - 
    +   /* 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); +} +
    @@ -899,13 +961,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     var session; //Session obtained from openSession callback
    - try {
    -  var atr = session.getATR();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var session; /* Session obtained from openSession callback */
    +try
    +{
    +   var atr = session.getATR();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -942,13 +1008,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     var session; //Session obtained from openSession callback
    - try {
    -  session.close();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var session; /* Session obtained from openSession callback */
    +try
    +{
    +   session.close();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -985,13 +1055,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     var session; //Session obtained from openSession callback
    - try {
    -  session.closeChannels();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var session; /* Session obtained from openSession callback */
    +try
    +{
    +   session.closeChannels();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1065,13 +1139,17 @@ The channel is defined in the ISO7816-4.
    -

    Code example:

     var channel; //Obtained from openLogicalChannel or openBasicChannel
    - try {
    -  channel.close();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var channel; /* Obtained from openLogicalChannel or openBasicChannel */
    +try
    +{
    +   channel.close();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html index 0eb43b9..27f3eec 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html @@ -421,16 +421,20 @@ The supported sensor types are hardware-dependent.

    To check if the given
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -458,10 +462,11 @@ The supported sensor types are hardware-dependent.

    To check if the given
    -

    Code example:

     var sensorCapabilities = tizen.sensorservice.getAvailableSensors();
    +

    Code example:

    +var sensorCapabilities = tizen.sensorservice.getAvailableSensors();
     
    - console.log("capable sensor : " + sensorCapabilities[0]);
    - 
    +console.log("capable sensor: " + sensorCapabilities[0]); +
    @@ -546,14 +551,16 @@ The supported sensor types are hardware-dependent.

    To check if the given
    -

    Code example:

     var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    +

    Code example:

    +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);
    - 
    +proximitySensor.start(onsuccessCB); +
    @@ -577,15 +584,17 @@ The supported sensor types are hardware-dependent.

    To check if the given
    -

    Code example:

     var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    +

    Code example:

    +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);
    - 
    +proximitySensor.start(onsuccessCB); +
    @@ -649,21 +658,24 @@ The start() method must be called to turn on the sensor, or the sensor data will
    -

    Code example:

     var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
    +

    Code example:

    +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);
    - 
    +lightSensor.start(onsuccessCB); +
    @@ -687,16 +699,18 @@ The start() method must be called to turn on the sensor, or the sensor data will
    -

    Code example:

     var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    +

    Code example:

    +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();
    - 
    +proximitySensor.unsetChangeListener(); +
    @@ -744,20 +758,22 @@ IOError - If the platform fails to internally prepare a socket for IPC communica
    -

    Code example:

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

    Code example:

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

    Output example:

      name: Gravity Sensor
    @@ -840,24 +856,27 @@ The ErrorCallback method is launched with these error types:
     
             
    -

    Code example:

     var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
    -
    - function onGetSuccessCB(sensorData) {
    -     console.log("light level : " + sensorData.lightLevel);
    - }
    +

    Code example:

    +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);
    +}
     
    - 
    +lightSensor.start(onsuccessCB); +
    @@ -929,26 +948,29 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1020,24 +1042,27 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

     var pressureSensor = tizen.sensorservice.getDefaultSensor("PRESSURE");
    +

    Code example:

    +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);
    -
    - 
    +pressureSensor.start(onsuccessCB); +
    @@ -1109,24 +1134,27 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

     var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    -
    - function onGetSuccessCB(sensorData) {
    -     console.log("proximity state : " + sensorData.proximityState);
    - }
    +

    Code example:

    +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);
    +}
     
    - 
    +proximitySensor.start(onsuccessCB); +
    @@ -1198,24 +1226,27 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

     var ultravioletSensor = tizen.sensorservice.getDefaultSensor("ULTRAVIOLET");
    -
    - function onGetSuccessCB(sensorData) {
    -     console.log("ultraviolet level : " + sensorData.ultravioletLevel);
    - }
    +

    Code example:

    +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);
    +}
     
    - 
    +ultravioletSensor.start(onsuccessCB); +
    @@ -1303,24 +1334,27 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

     var HRMrawsensor = tizen.sensorservice.getDefaultSensor("HRM_RAW");
    -
    - function onGetSuccessCB(sensorData) {
    -     console.log("HRMRaw light intensity : " + sensorData.lightIntensity);
    - }
    +

    Code example:

    +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);
    +}
     
    - 
    +HRMrawsensor.start(onsuccessCB); +
    @@ -1392,26 +1426,30 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

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

    Code example:

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

    Output example:

     sensor start
    @@ -1491,26 +1529,30 @@ The ErrorCallback method is launched with these error types:
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     sensor start
    @@ -1590,27 +1632,31 @@ The ErrorCallback method is launched with these error types:
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     sensor start
    @@ -1691,26 +1737,30 @@ The ErrorCallback method is launched with these error types:
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     linear acceleration sensor start
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/sound.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/sound.html
    index c2fc956..594fc9c 100644
    --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/sound.html
    +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/sound.html
    @@ -551,12 +551,14 @@ There is a tizen.sound object that allows accessing the functionality of the Sou
     
             
    -

    Code example:

     var infoArr = tizen.sound.getConnectedDeviceList();
    +

    Code example:

    +var infoArr = tizen.sound.getConnectedDeviceList();
     
    - for (var i = 0; i < infoArr.length; i++) {
    -     console.log( infoArr[i].device );
    - }
    - 
    +for (var i = 0; i < infoArr.length; i++) +{ +   console.log(infoArr[i].device); +} +
    @@ -584,12 +586,14 @@ There is a tizen.sound object that allows accessing the functionality of the Sou
    -

    Code example:

     var infoArr = tizen.sound.getActivatedDeviceList();
    +

    Code example:

    +var infoArr = tizen.sound.getActivatedDeviceList();
     
    - for (var i = 0; i < infoArr.length; i++) {
    -     console.log( infoArr[i].device );
    - }
    - 
    +for (var i = 0; i < infoArr.length; i++) +{ +   console.log(infoArr[i].device); +} +
    @@ -642,28 +646,36 @@ Activation: When a device chages from being activated to being deactivated or fr
    -

    Code example:

     // 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" );
    -     }
    +

    Code example:

    +/* 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);
    - 
    +var id = tizen.sound.addDeviceStateChangeListener(onChanged); +
    @@ -696,9 +708,10 @@ Activation: When a device chages from being activated to being deactivated or fr
    -

    Code example:

     // If a listener to be called was registered previously.
    - tizen.sound.removeDeviceStateChangeListener(id);
    - 
    +

    Code example:

    +/* If a listener to be called was registered previously */
    +tizen.sound.removeDeviceStateChangeListener(id);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/systeminfo.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/systeminfo.html index fd2f1a4..158febc 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/systeminfo.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/systeminfo.html @@ -509,9 +509,10 @@ and for subscribing notifications of system information changes.
    -

    Code example:

     // To get total amount of system memory
    - console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
    - 
    +

    Code example:

    +/* To get total amount of system memory */
    +console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
    +
    @@ -535,9 +536,10 @@ and for subscribing notifications of system information changes.
    -

    Code example:

     // To get total amount of system memory
    - console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
    - 
    +

    Code example:

    +/* To get total amount of system memory */
    +console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
    +
    @@ -569,12 +571,14 @@ The function must synchronously acquire the capabilities of the device.
    -

    Code example:

     var deviceCapabilities;
    - deviceCapabilities = tizen.systeminfo.getCapabilities();
    - if (deviceCapabilities.bluetooth) {
    -     console.log("Bluetooth is supported");
    - }
    - 
    +

    Code example:

    +var deviceCapabilities;
    +deviceCapabilities = tizen.systeminfo.getCapabilities();
    +if (deviceCapabilities.bluetooth)
    +{
    +   console.log("Bluetooth is supported");
    +}
    +
    @@ -617,14 +621,18 @@ The additional keys for the custom device capability are specified by OEM's and
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -666,13 +674,17 @@ That is the length of array retrieved by the getPropertyValueArray() method for
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -751,36 +763,45 @@ NotSupportedError - If the given property is not supported. (since Ti
    -

    Code example:

     function onSuccessCallback(cpu) {
    -     console.log("The cpu load is " + cpu.load);
    - }
    +

    Code example:

    +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);
    - 
    +tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback); +
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -855,26 +876,35 @@ NotSupportedError - If the given property is not supported.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -978,12 +1008,14 @@ NotSupportedError - If the given property is not supported. (since Ti
    -

    Code example:

     function onSuccessCallback(cpu) {
    -     console.log("The cpu load : " + cpu.load);
    - }
    +

    Code example:

    +function onSuccessCallback(cpu)
    +{
    +   console.log("The cpu load: " + cpu.load);
    +}
     
    - tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold : 0.2});
    - 
    +tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2}); +
    @@ -1116,16 +1148,20 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3390,15 +3426,15 @@ Since:
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -3509,19 +3545,22 @@ If the specified brightness value is not supported by the device, the brightness
  • -

    Code example:

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

    Code example:

    +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);
    +});
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/systemsetting.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/systemsetting.html index d1c9c74..f7e87a0 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/systemsetting.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/systemsetting.html @@ -238,37 +238,45 @@ UnknownError - If any other error occurs
    -

    Code example:

     // Checks whether SystemSetting API is supported.
    - var systemsetting_api_supported = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting");
    +

    Code example:

    +/* 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.");
    - }
    -
    - 
    +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."); +} +
    @@ -337,21 +345,23 @@ UnknownError - If any other error occurs
    -

    Code example:

     // 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.
    - }
    +

    Code example:

    +/* 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 */
    +}
     
    - 
    +tizen.systemsetting.getProperty("HOME_SCREEN", getPropertySuccessCallback, errorCallback); +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/time.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/time.html index 27b0fdd..48df608 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/time.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/time.html @@ -273,9 +273,10 @@ Get timezones using getLocalTimezone() and getAvailableTimezones(). <
    -

    Code example:

     var current_dt = tizen.time.getCurrentDateTime();
    - console.log("current date/time is " + current_dt.toLocaleString());
    - 
    +

    Code example:

    +var current_dt = tizen.time.getCurrentDateTime();
    +console.log("current date/time is " + current_dt.toLocaleString());
    +
    @@ -303,16 +304,18 @@ Get timezones using getLocalTimezone() and getAvailableTimezones(). <
    -

    Code example:

     console.log("The local time zone is " + tizen.time.getLocalTimezone());
    - 
    +

    Code example:

    +console.log("The local time zone is " + tizen.time.getLocalTimezone());
    +
    -

    Code example:

     // 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');
    +

    Code example:

    +/* 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());
    - 
    +/* Outputs "Wednesday, January 27, 2016, 8:46:00 PM GMT+0800 Philippines Time" */ +console.log(now.toString()); +
    @@ -347,21 +350,26 @@ with the most general descriptor first and the most specific one last. For examp
    -

    Code example:

     var tzids = tizen.time.getAvailableTimezones();
    - console.log("The device supports " + tzids.length + " time zones.");
    - 
    +

    Code example:

    +var tzids = tizen.time.getAvailableTimezones();
    +console.log("The device supports " + tzids.length + " time zones.");
    +
    -

    Code example:

     var tzids = tizen.time.getAvailableTimezones();
    - var currentLocation = 'Europe/Berlin';
    +

    Code example:

    +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.');
    - }
    - 
    +/* 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.'); +} +
    @@ -419,14 +427,15 @@ date format (23/10/2011) instead of a long date format ("Monday, October 23 2011
    -

    Code example:

     // Gets the long date format, e.g. "D, M d y".
    - var dateFormat = tizen.time.getDateFormat();
    +

    Code example:

    +/* 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);
    - 
    +console.log("Long date format: " + dateFormat); +
    @@ -472,11 +481,12 @@ Examples of string formats include: "h:m:s ap", "h:m:s".
    -

    Code example:

     // Gets the time format, e.g. "h:m:s ap".
    - var timeFormat = tizen.time.getTimeFormat();
    +

    Code example:

    +/* Gets the time format, e.g. "h:m:s ap" */
    +var timeFormat = tizen.time.getTimeFormat();
     
    - console.log(timeFormat);
    - 
    +console.log(timeFormat); +
    @@ -523,12 +533,14 @@ parameters contain an invalid value.
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -570,19 +582,22 @@ Listener set with setTimezoneChangeListener() method is called when dev
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -606,19 +621,23 @@ Listener set with setTimezoneChangeListener() method is called when dev
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -662,19 +681,23 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -698,18 +721,23 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -843,15 +871,16 @@ If its date/time exceeds the platform limit, TZDate will be invalid.
    -

    Code example:

     // Creates a new TZDate object with current date/time and timezone:
    - var now = new tizen.TZDate();
    +

    Code example:

    +/* 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');
    - 
    +/* Creates a new TZDate object with values set explicitly */ +var myDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/Berlin'); +
    @@ -876,9 +905,10 @@ If its date/time exceeds the platform limit, TZDate will be invalid. long The day of the month.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getDate()); // should output 31.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getDate()); /* Outputs 31 */
    +
    @@ -910,10 +940,11 @@ For example, if TZDate's month is May and parameter is 32, it will be set to Jun
    -

    Code example:

     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.
    - 
    +

    Code example:

    +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 */
    +
    @@ -934,9 +965,9 @@ For example, if TZDate's month is May and parameter is 32, it will be set to Jun long The day of the week
    -

    Code example:

     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.
    -     
    +

    Code example:

    +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 */
     
    @@ -964,9 +995,10 @@ For example, 1 = AD 1, 0 = BC 1, -1 = BC 2. long The year
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getFullYear()); // should output 1999.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getFullYear()); /* Outputs 1999 */
    +
    @@ -992,10 +1024,11 @@ For example, 1 = AD 1, 0 = BC 1, -1 = BC 2.
    -

    Code example:

     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.
    - 
    +

    Code example:

    +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 */
    +
    @@ -1016,9 +1049,10 @@ For example, 1 = AD 1, 0 = BC 1, -1 = BC 2. long The hour
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getHours()); // should output 23.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getHours()); /* Outputs 23 */
    +
    @@ -1050,10 +1084,11 @@ For example, calling setHours(24) results in setting hour to 00:00 and date to t
    -

    Code example:

     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.
    - 
    +

    Code example:

    +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 */
    +
    @@ -1074,9 +1109,10 @@ For example, calling setHours(24) results in setting hour to 00:00 and date to t long The milliseconds
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getMilliseconds()); // should output 999.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getMilliseconds()); /* Outputs 999 */
    +
    @@ -1108,10 +1144,11 @@ For example, calling setMilliseconds(1000) results in setting milliseconds to 0
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - someDate.setMilliseconds(42);
    - console.log(someDate.getMilliseconds()); // should output 42.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +someDate.setMilliseconds(42);
    +console.log(someDate.getMilliseconds()); /* Outputs 42 */
    +
    @@ -1132,9 +1169,10 @@ For example, calling setMilliseconds(1000) results in setting milliseconds to 0 long The minutes
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getMinutes()); // should output 59.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getMinutes()); /* Outputs 59 */
    +
    @@ -1167,10 +1205,11 @@ For example, calling setMinutes(60) results in setting minutes to 0 and adding o
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - someDate.setMinutes(58);
    - console.log(someDate.getMinutes()); // should output 58.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +someDate.setMinutes(58);
    +console.log(someDate.getMinutes()); /* Outputs 58 */
    +
    @@ -1191,9 +1230,10 @@ For example, calling setMinutes(60) results in setting minutes to 0 and adding o long The month
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getMonth()); // should output 11.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getMonth()); /* Outputs 11 */
    +
    @@ -1225,10 +1265,11 @@ For example, calling setMonth(12) results in setting month to 0 and adding one y
    -

    Code example:

     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.
    - 
    +

    Code example:

    +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 */
    +
    @@ -1249,9 +1290,10 @@ For example, calling setMonth(12) results in setting month to 0 and adding one y long The seconds
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getSeconds()); // should output 59.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getSeconds()); /* Outputs 59 */
    +
    @@ -1283,10 +1325,11 @@ For example, calling setSeconds(60) results in setting seconds to 0 and adding o
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - someDate.setSeconds(23);
    - console.log(someDate.getSeconds()); // should output 23.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +someDate.setSeconds(23);
    +console.log(someDate.getSeconds()); /* Outputs 23 */
    +
    @@ -1307,9 +1350,10 @@ For example, calling setSeconds(60) results in setting seconds to 0 and adding o long The day of the month, according to universal time
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getUTCDate()); // should output 31.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getUTCDate()); /* Outputs 31 */
    +
    @@ -1341,10 +1385,11 @@ For example, calling setUTCDate(32) when TZDate's month is May results in settin
    -

    Code example:

     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.
    - 
    +

    Code example:

    +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 */
    +
    @@ -1365,9 +1410,10 @@ For example, calling setUTCDate(32) when TZDate's month is May results in settin long The day of the week, according to universal time
    -

    Code example:

     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.
    - 
    +

    Code example:

    +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 */
    +
    @@ -1394,9 +1440,10 @@ For example, 1 = AD 1, 0 = BC 1, -1 = BC 2. long The year, according to universal time
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getUTCFullYear()); // should output 1999.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getUTCFullYear()); /* Outputs 1999 */
    +
    @@ -1422,10 +1469,11 @@ For example, 1 = AD 1, 0 = BC 1, -1 = BC 2.
    -

    Code example:

     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.
    - 
    +

    Code example:

    +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 */
    +
    @@ -1446,9 +1494,10 @@ For example, 1 = AD 1, 0 = BC 1, -1 = BC 2. long The hour, according to universal time
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getUTCHours()); // should output 23.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getUTCHours()); /* Outputs 23 */
    +
    @@ -1480,10 +1529,11 @@ For example, calling setUTCHours(24) results in setting hour to 0 and adding one
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - someDate.setUTCHours(15);
    - console.log(someDate.getUTCHours()); // should output 15.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +someDate.setUTCHours(15);
    +console.log(someDate.getUTCHours()); /* Outputs 15 */
    +
    @@ -1504,9 +1554,10 @@ For example, calling setUTCHours(24) results in setting hour to 0 and adding one long The milliseconds, according to universal time
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getUTCMilliseconds()); // should output 999.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getUTCMilliseconds()); /* Outputs 999 */
    +
    @@ -1538,10 +1589,11 @@ For example, calling setUTCMilliseconds(1000) results in setting milliseconds to
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - someDate.setUTCMillisecond(42);
    - console.log(someDate.getUTCMilliseconds()); // should output 42.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +someDate.setUTCMillisecond(42);
    +console.log(someDate.getUTCMilliseconds()); /* Outputs 42 */
    +
    @@ -1562,9 +1614,10 @@ For example, calling setUTCMilliseconds(1000) results in setting milliseconds to long The minutes, according to universal time
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getUTCMinutes()); // should output 59.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getUTCMinutes()); /* Outputs 59 */
    +
    @@ -1596,10 +1649,11 @@ For example, calling setUTCMinutes(60) results in setting minutes to 0 and addin
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - someDate.setUTCMinutes(58);
    - console.log(someDate.getUTCMinutes()); // should output 58.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +someDate.setUTCMinutes(58);
    +console.log(someDate.getUTCMinutes()); /* Outputs 58 */
    +
    @@ -1620,9 +1674,10 @@ For example, calling setUTCMinutes(60) results in setting minutes to 0 and addin long The month, according to universal time
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getUTCMonth()); // should output 11.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getUTCMonth()); /* Outputs 11 */
    +
    @@ -1654,10 +1709,11 @@ For example, calling setUTCMonth(12) results in setting month to 0 and adding on
    -

    Code example:

     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.
    - 
    +

    Code example:

    +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 */
    +
    @@ -1678,9 +1734,10 @@ For example, calling setUTCMonth(12) results in setting month to 0 and adding on long The seconds, according to universal time
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getUTCSeconds()); // should output 59.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getUTCSeconds()); /* Outputs 59 */
    +
    @@ -1712,10 +1769,11 @@ For example, calling setUTCSeconds(60) results in setting seconds to 0 and addin
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - someDate.setUTCSeconds(23);
    - console.log(someDate.getUTCSeconds()); // should output 23.
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +someDate.setUTCSeconds(23);
    +console.log(someDate.getUTCSeconds()); /* Outputs 23 */
    +
    @@ -1746,9 +1804,10 @@ This attribute uniquely identifies the timezone. DOMString The string timezone identifier
    If TZDate is invalid, it will return 'Invalid Date'.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - console.log(someDate.getTimezone()); // should output "Europe/London".
    - 
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    +console.log(someDate.getTimezone()); /* Outputs "Europe/London" */
    +
    @@ -1795,12 +1854,13 @@ is not recognized as a valid timezone identifier.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Europe/London");
    - var koreanDate = someDate.toTimezone("Asia/Seoul");
    +

    Code example:

    +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());
    - 
    +/* Output: "Saturday, January 1, 2000, 8:59:59 AM GMT+0900 South Korea Time" */ +console.log(someDate.toString()); +
    @@ -1828,14 +1888,17 @@ is not recognized as a valid timezone identifier.
    -

    Code example:

     // 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();
    +

    Code example:

    +/*
    +   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());
    - 
    +/* Output: "Saturday, January 1, 2000, 8:59:59 AM GMT+0900 South Korea Time" */ +console.log(localDate.toString()); +
    @@ -1863,12 +1926,13 @@ is not recognized as a valid timezone identifier.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, "Asia/Seoul");
    - var utcDate = someDate.toUTC();
    +

    Code example:

    +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());
    - 
    +/* Output: "Friday, December 31, 1999, 2:59:59 PM GMT+0000 GMT" */ +console.log(utcDate.toString()); +
    @@ -1931,28 +1995,30 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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");
    +

    Code example:

    +/* 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);
    - 
    +/* Output: "The difference is 365 DAYS" (since none of those dates have time component) */ +console.log("The difference is " + difference.length + " " + difference.unit); +
    -

    Code example:

     // 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");
    +

    Code example:

    +/* 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);
    - 
    +/* Output: "The difference is 7200000 MSECS" (since both of those dates do have time component) */ +console.log("The difference is " + difference.length + " " + difference.unit); +
    @@ -2000,31 +2066,41 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -2072,18 +2148,19 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // Create a new TZDate object pointing to noon in London:
    - var tzd1 = new tizen.TZDate(2016, 0, 1, 12, 0, 0, 0, 'Europe/London');
    +

    Code example:

    +/* 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);
    - 
    +/* Outputs 'false', since local time in Seoul is GMT (London) + 9 hours */ +console.log(isEarlier); +
    @@ -2131,18 +2208,19 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // Create a new TZDate object pointing to noon in London:
    - var tzd1 = new tizen.TZDate(2016, 0, 1, 12, 0, 0, 0, 'Europe/London');
    +

    Code example:

    +/* 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);
    - 
    +/* Outputs 'true', since local time in Seoul is GMT (London) + 9 hours */ +console.log(isLater); +
    @@ -2194,9 +2272,10 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var now = tizen.time.getCurrentDateTime();
    - var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
    - 
    +

    Code example:

    +var now = tizen.time.getCurrentDateTime();
    +var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
    +
    @@ -2217,11 +2296,12 @@ is not compatible with the expected type for that parameter. DOMString The date portion of the TZDate object as a string, using locale conventions
    If TZDate is invalid, it will return 'Invalid Date'.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
    +

    Code example:

    +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());
    - 
    +/* Output example (depends on locale settings): "Friday, December 31, 1999" */ +console.log(someDate.toLocaleDateString()); +
    @@ -2242,11 +2322,12 @@ is not compatible with the expected type for that parameter. DOMString The time portion of the TZDate object as a string, using locale conventions
    If TZDate is invalid, it will return 'Invalid Date'.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
    +

    Code example:

    +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());
    - 
    +/* Output example (depends on locale settings): "11:59:59 PM" */ +console.log(someDate.toLocaleTimeString()); +
    @@ -2267,11 +2348,12 @@ is not compatible with the expected type for that parameter. DOMString The string representation of the TZDate object, using locale conventions
    If TZDate is invalid, it will return 'Invalid Date'.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
    +

    Code example:

    +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());
    - 
    +/* Output example (depends on locale settings): "Friday, December 31, 1999, 11:59:59 PM" */ +console.log(someDate.toLocaleString()); +
    @@ -2292,11 +2374,12 @@ is not compatible with the expected type for that parameter. DOMString The date portion of the TZDate object as a string
    If TZDate is invalid, it will return 'Invalid Date'.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
    +

    Code example:

    +var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
     
    - // Should output: "Friday, December 31, 1999"
    - console.log(someDate.toDateString());
    - 
    +/* Output: "Friday, December 31, 1999" */ +console.log(someDate.toDateString()); +
    @@ -2317,11 +2400,12 @@ is not compatible with the expected type for that parameter. DOMString The time portion of the TZDate object as a string
    If TZDate is invalid, it will return 'Invalid Date'.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
    +

    Code example:

    +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());
    - 
    +/* Output: "11:59:59 PM GMT+0000 United Kingdom Time" */ +console.log(someDate.toTimeString()); +
    @@ -2342,11 +2426,12 @@ is not compatible with the expected type for that parameter. DOMString The string representation of the TZDate object
    If TZDate is invalid, it will return 'Invalid Date'.
    -

    Code example:

     var someDate = new tizen.TZDate(1999, 11, 31, 23, 59, 59, 999, 'Europe/London');
    +

    Code example:

    +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());
    - 
    +/* Output: "Friday, December 31, 1999, 11:59:59 PM GMT+0000 United Kingdom Time" */ +console.log(someDate.toString()); +
    @@ -2414,11 +2499,12 @@ savings if it is in the timezone. For example, if time zone is GMT+8, it will re
    -

    Code example:

     var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
    - var myDate = new Date();
    - var exp_offset = myDate.getTimezoneOffset()*60;
    - //offset is equals to exp_offset.
    - 
    +

    Code example:

    +var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
    +var myDate = new Date();
    +var exp_offset = myDate.getTimezoneOffset() * 60;
    +/* offset is equal to exp_offset */
    +
    @@ -2452,12 +2538,13 @@ identified by the TZDate object.
    -

    Code example:

     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');
    +

    Code example:

    +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
    - 
    +var isDstActiveInSummer = summertime.isDST(); /* true */ +var isDstActiveInWinter = wintertime.isDST(); /* false */ +
    @@ -2485,15 +2572,16 @@ identified by the TZDate object.
    -

    Code example:

     // Creates the TZDate object pointing to January 2016.
    - var winter16 = new tizen.TZDate(2016, 0, 1, 10, 0, 0, 0, 'Europe/London');
    +

    Code example:

    +/* 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());
    - 
    +/* Output: "Sunday, October 25, 2015, 1:00:00 AM GMT+0000 United Kingdom Time" */ +console.log(previousDstTransition.toString()); +
    @@ -2521,15 +2609,16 @@ identified by the TZDate object.
    -

    Code example:

     // Creates the TZDate object pointing to January 2016.
    - var winter16 = new tizen.TZDate(2016, 0, 1, 10, 0, 0, 0, 'Europe/London');
    +

    Code example:

    +/* 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());
    - 
    +/* Output: "Sunday, March 27, 2016, 2:00:00 AM GMT+0100 United Kingdom Time" */ +console.log(nextDstTransition.toString()); +
    @@ -2569,9 +2658,10 @@ identified by the TZDate object.
    TimeDuration(long long length, optional TimeDurationUnit? unit);
    -

    Code example:

     var now = tizen.time.getCurrentDateTime();
    - var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); // Becomes tomorrow, same time.
    - 
    +

    Code example:

    +var now = tizen.time.getCurrentDateTime();
    +var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); /* Becomes tomorrow, same time */
    +
    @@ -2607,15 +2697,15 @@ The default value is "MSECS" (milliseconds unit). 1.0

    -

    Code example:

     
    - // Changing both length and unit of existing TimeDuration objects is possible:
    +

    Code example:

    +/* 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.
    - 
    +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 */ +
    @@ -2672,16 +2762,17 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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.");
    - 
    +

    Code example:

    +/* 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.");
    +
    @@ -2730,10 +2821,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    @@ -2779,10 +2871,11 @@ This method takes the units into consideration when doing the comparison.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    @@ -2829,10 +2922,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/tizen.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/tizen.html index 60fba17..9fea2fb 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/tizen.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/tizen.html @@ -295,21 +295,24 @@ the specified value.

    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree".
    - var count = 100;
    - var offset = 0;
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    -
    - function findCB(contents) {
    -     console.log('The Joshua Tree :' + contents.length);
    - }
    -
    - tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -398,25 +401,30 @@ Range filters, where only one boundary is set, are available.

    -

    Code example:

     var count = 100;
    - var offset = 0;
    - // Use the modifiedDate attribute with a range that starts today and ends in 1 day
    - // (meaning that you search for all contents modified today)
    - var today = new Date();
    - var today_begin = new Date(today.getFullYear(), today.getMonth(),today.getDate());
    - var today_end = new Date(today.getFullYear(), today.getMonth(),today.getDate()+1);
    - var dateRangeFilter = new tizen.AttributeRangeFilter("modifiedDate", today_begin, today_end);
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    -
    - function findCB(contents) {
    -     console.log('The contents modified today :' + contents.length);
    - }
    -
    - tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
    - 
    +

    Code example:

    +var count = 100;
    +var offset = 0;
    +/*
    +   Use the modifiedDate attribute with a range that starts today and ends in 1 day
    +   (meaning that you search for all contents modified today)
    +*/
    +var today = new Date();
    +var today_begin = new Date(today.getFullYear(), today.getMonth(), today.getDate());
    +var today_end = new Date(today.getFullYear(), today.getMonth(), today.getDate()+1);
    +var dateRangeFilter = new tizen.AttributeRangeFilter("modifiedDate", today_begin, today_end);
    +
    +function errorCB(err)
    +{
    +   console.log('The following error occurred: ' +  err.name);
    +}
    +
    +function findCB(contents)
    +{
    +   console.log('The contents modified today:' + contents.length);
    +}
    +
    +tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
    +
    @@ -504,42 +512,48 @@ The intersection - used to filter objects that match all the filters it includes
    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2".
    - var count = 100;
    - var offset = 0;
    - var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "U2");
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    - var filter = new tizen.CompositeFilter("INTERSECTION", [albumFilter, artistFilter]);
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    -
    - function findCB(contents) {
    -     console.log('The Joshua Tree by U2:' + contents.length);
    - }
    -
    - tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
    - 
    +

    Code example:

    +/* 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);
    +
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -592,34 +606,40 @@ Note that the sorting result of list type attributes is not determined.

    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the track number.
    - var count = 100;
    - var offset = 0;
    - var sortMode = new tizen.SortMode("trackNumber", "ASC");
    - var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "U2");
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    - var filter = new tizen.CompositeFilter("INTERSECTION", [albumFilter, artistFilter]);
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    -
    - function printContent(content, index, contents) {
    -     console.log('Track: ' + content.trackNumber + ' Title: ' + content.title + 'Duration: ' + content.duration + 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
    - }
    -
    - function findCB(contents) {
    -     console.log('The Joshua Tree by U2:');
    -     contents.forEach(printContent);
    -     // Increase the offset as much as the count and then find content again.
    -     if (contents.length == count) {
    -         offset += count;
    -         tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
    -     }
    - }
    -
    - tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
    - 
    +

    Code example:

    +/* 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);
    +

    Constructors

    @@ -675,26 +695,31 @@ Latitude and longitude are of the WGS84 datum.

    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Constructors

    @@ -1199,14 +1224,15 @@ In case of successful execution of an asynchronous call, SuccessCallback

    Code example:

    -  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);
     
    @@ -1251,19 +1277,21 @@ it silently fails and there is no further action.

    Code example:

    -  // 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);
     
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/websetting.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/websetting.html index 00d2ab2..7ac06cf 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/websetting.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/websetting.html @@ -156,12 +156,14 @@ InvalidValuesError - If any of the input parameters contain an invalid value.
    -

    Code example:

     function successCallback() {
    -     console.log("The requested user agent string has just been set successfully.");
    - }
    +

    Code example:

    +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);
    - 
    +tizen.websetting.setUserAgentString("the new user agent string to set", successCallback); +
    @@ -213,12 +215,14 @@ UnknownError - If any error occurs while deleting the cookies.
    -

    Code example:

     function successCallback() {
    -     console.log("The cookies saved for your application have just been removed.");
    - }
    +

    Code example:

    +function successCallback()
    +{
    +   console.log("The cookies saved for your application have just been removed.");
    +}
     
    - tizen.websetting.removeAllCookies(successCallback);
    - 
    +tizen.websetting.removeAllCookies(successCallback); +
    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/widgetservice.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/widgetservice.html index 09f42b9..c55fb2f 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/widgetservice.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/widgetservice.html @@ -428,19 +428,23 @@ The tizen.widgetservice object provides access to the Widget service AP
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Widget id is org.tizen.gallery.widget
    @@ -515,12 +519,15 @@ NotFoundError - If the device has no widgets or if a widget with the given id do
     
             
    -

    Code example:

     tizen.widgetservice.getWidgets(function (widgets) {
    -   console.log("There are " + widgets.length + " available widgets");
    - }, function (error) {
    -    console.log("Error: " + error.message);
    - });
    - 
    +

    Code example:

    +tizen.widgetservice.getWidgets(function(widgets)
    +{
    +   console.log("There are " + widgets.length + " available widgets");
    +}, function(error)
    +{
    +   console.log("Error: " + error.message);
    +});
    +

    Output example:

     There are 3 available widgets
    @@ -580,15 +587,19 @@ NotFoundError - If the device has no widgets or if a widget with the given id do
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Widget id is org.tizen.gallery.widget
    @@ -600,7 +611,7 @@ NotFoundError - If the device has no widgets or if a widget with the given id do
     
    - Returns the size coresponding to the given sizeType. + Returns the size corresponding to the given sizeType.
    WidgetSize getSize(WidgetSizeType sizeType);
                  
    @@ -629,15 +640,19 @@ NotFoundError - If the device has no widgets or if a widget with the given id do
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Widget size width: 712, height: 712
    @@ -775,17 +790,21 @@ Precondition: Widget tag in the config.xml file includes the "nodisplay" attribu
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Widget name is Gallery
    @@ -842,24 +861,30 @@ SecurityError - If the widget does not belong to the package of the web applicat
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     Instances array size: 3
    @@ -905,17 +930,21 @@ SecurityError - If the widget does not belong to the package of the web applicat
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Variant preview image path is /usr/share/icons/default/small/preview_gallery_4x4.png
    @@ -965,24 +994,30 @@ AbortError - If the operation cannot be finished properly.              
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     Variants array size: 4
    @@ -1028,21 +1063,26 @@ AbortError - If the operation cannot be finished properly.              
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     Listener with id 1 has been added.
    @@ -1080,23 +1120,28 @@ AbortError - If the operation cannot be finished properly.              
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     Listener with id 1 has been removed.
    @@ -1336,17 +1381,21 @@ Every visual widget element added to the home screen is a single instance of som
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Update period has been set to 2 seconds.
    @@ -1400,21 +1449,26 @@ This function does not wait for a confirmation that the data was updated.
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Data has been successfully sent
    @@ -1466,31 +1520,38 @@ AbortError - If the operation cannot be finished properly.              
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Data has been obtained successfully
    - data1 : test1
    - data2 : test2
    + data1: test1
    + data2: test2
      
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/alarm.html b/org.tizen.web.apireference/html/device_api/tv/tizen/alarm.html index 1f864ec..e5a15b5 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/alarm.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/alarm.html @@ -283,12 +283,13 @@ For more information about the application control, see -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -345,18 +346,23 @@ If an alarm goes off, it will be removed from the storage automatically.
    -

    Code example:

     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.");
    -   }
    - }
    - 
    +

    Code example:

    +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.");
    +   }
    +}
    +
    @@ -398,9 +404,10 @@ Because each application has its own alarm storage, this method removes alarms o
    -

    Code example:

     tizen.alarm.removeAll();
    - console.log("remove all registered alarms in the storage.");
    - 
    +

    Code example:

    +tizen.alarm.removeAll();
    +console.log("remove all registered alarms in the storage.");
    +
    @@ -445,18 +452,19 @@ Because each application has its own alarm storage, this method removes alarms o
    -

    Code example:

     // Sets an alarm
    - var date = new Date();
    - date.setHours(date.getHours()+1);
    - var abs_alarm = new tizen.AlarmAbsolute(date);
    +

    Code example:

    +/* 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());
    - 
    +/* Gets an alarm */ +var alarm = tizen.alarm.get(abs_alarm.id); +console.log("The alarm will trigger at " + alarm.getNextScheduledDate()); +
    @@ -489,9 +497,10 @@ Alarms that have already been triggered are removed automatically from the stora
    -

    Code example:

     var alarms = tizen.alarm.getAll();
    - console.log(alarms.length + " alarms present in the storage.");
    - 
    +

    Code example:

    +var alarms = tizen.alarm.getAll();
    +console.log(alarms.length + " alarms present in the storage.");
    +
    @@ -553,17 +562,18 @@ It is guaranteed that this alarm will be fired after at least delay sec If period is provided, it will be adjusted by the operating system, however this value will not be lower than 600 seconds.

    -

    Code example:

     // Gets the current application ID.
    - var appId = tizen.application.getCurrentApplication().appInfo.id;
    +

    Code example:

    +/* 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);
    - 
    +/* 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); +
    @@ -635,16 +645,17 @@ If the alarm has expired, this method returns null.
    -

    Code example:

     // Gets the current application ID.
    - var appId = tizen.application.getCurrentApplication().appInfo.id;
    +

    Code example:

    +/* 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);
    - 
    +var sec = alarm.getRemainingSeconds(); +console.log("remaining time is " + sec); +
    @@ -679,22 +690,23 @@ If a period is provided, the alarm keeps triggering for the given inter

    -

    Code example:

     // Gets the current application ID.
    - var appId = tizen.application.getCurrentApplication().appInfo.id;
    +

    Code example:

    +/* 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);
    - 
    +/* 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); +
    @@ -791,17 +803,18 @@ If the alarm has expired, this method returns null. The returned date
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/application.html b/org.tizen.web.apireference/html/device_api/tv/tizen/application.html index 3ed6f2f..b43de5b 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/application.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/application.html @@ -390,9 +390,10 @@ The tizen.application object allows access to the Application API's fun
    -

    Code example:

     var app = tizen.application.getCurrentApplication();
    - console.log("Current application's app id is " + app.appInfo.id);
    - 
    +

    Code example:

    +var app = tizen.application.getCurrentApplication();
    +console.log("Current application's app id is " + app.appInfo.id);
    +
    @@ -460,23 +461,28 @@ UnknownError - If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -541,13 +547,15 @@ UnknownError - If any other error occurs.
    -

    Code example:

     function onsuccess() {
    -     console.log("The application has launched successfully");
    - }
    +

    Code example:

    +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);
    - 
    +/* Let's assume that application "targetApp0.main" has been installed */ +tizen.application.launch("targetApp0.main", onsuccess); +
    @@ -641,34 +649,33 @@ UnknownError: If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -723,42 +730,41 @@ UnknownError - If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -805,13 +811,15 @@ UnknownError - If an unknown error occurs.
    -

    Code example:

     function onRunningAppsContext(contexts) {
    -     for (var i = 0; i < contexts.length; i++)
    -         console.log("ID : " + contexts[i].id);
    - }
    +

    Code example:

    +function onRunningAppsContext(contexts)
    +{
    +   for (var i = 0; i < contexts.length; i++)
    +      console.log("ID: " + contexts[i].id);
    +}
     
    - tizen.application.getAppsContext(onRunningAppsContext);
    - 
    +tizen.application.getAppsContext(onRunningAppsContext); +
    @@ -855,9 +863,10 @@ The list of running applications and their application IDs is obtained with
    -

    Code example:

     var appContext = tizen.application.getAppContext(null);
    - console.log("Application context retrieved for app " + appContext.appId);
    - 
    +

    Code example:

    +var appContext = tizen.application.getAppContext(null);
    +console.log("Application context retrieved for app " + appContext.appId);
    +
    @@ -904,13 +913,15 @@ UnknownError - If an unknown error occurs.
    -

    Code example:

     function onListInstalledApps(applications) {
    -     for (var i = 0; i < applications.length; i++)
    -         console.log("ID : " + applications[i].id);
    - }
    +

    Code example:

    +function onListInstalledApps(applications)
    +{
    +   for (var i = 0; i < applications.length; i++)
    +      console.log("ID: " + applications[i].id);
    +}
     
    - tizen.application.getAppsInfo(onListInstalledApps);
    - 
    +tizen.application.getAppsInfo(onListInstalledApps); +
    @@ -958,9 +969,10 @@ The list of installed applications and their application IDs is obtained with
    -

    Code example:

     var appInfo = tizen.application.getAppInfo(null);
    - console.log("Current application name : " + appInfo.name);
    - 
    +

    Code example:

    +var appInfo = tizen.application.getAppInfo(null);
    +console.log("Current application name: " + appInfo.name);
    +
    @@ -1041,13 +1053,15 @@ The certificate types are listed below:
    -

    Code example:

     var appCerts = tizen.application.getAppCerts(null);
    +

    Code example:

    +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);
    - }
    - 
    +for (var i = 0; i < appCerts.length; i++) +{ +   console.log("#" + i + " type:" + appCerts[i].type); +   console.log("#" + i + " value:" + appCerts[i].value); +} +
    @@ -1095,9 +1109,10 @@ If the ID is set to null or not set at all, it returns the shared dir
    -

    Code example:

     var sharedDir = tizen.application.getAppSharedURI(null);
    - console.log("shared directory : " + sharedDir);
    - 
    +

    Code example:

    +var sharedDir = tizen.application.getAppSharedURI(null);
    +console.log("shared directory: " + sharedDir);
    +
    @@ -1156,10 +1171,10 @@ an empty array is returned
    -

    Code example:

     var metaDataArray = tizen.application.getAppMetaData(null);
    - console.log("size of metadata : " + metaDataArray.length);
    -
    - 
    +

    Code example:

    +var metaDataArray = tizen.application.getAppMetaData(null);
    +console.log("size of metadata: " + metaDataArray.length);
    +
    @@ -1226,19 +1241,24 @@ with the corresponding listener identifier.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1281,20 +1301,25 @@ Instead, you can use -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1379,10 +1404,11 @@ the basic operations (such as exit or hide) for the current application.
    -

    Code example:

     var app = tizen.application.getCurrentApplication();
    +

    Code example:

    +var app = tizen.application.getCurrentApplication();
     
    - app.exit();
    - 
    +app.exit(); +
    @@ -1406,10 +1432,11 @@ the basic operations (such as exit or hide) for the current application.
    -

    Code example:

     var app = tizen.application.getCurrentApplication();
    +

    Code example:

    +var app = tizen.application.getCurrentApplication();
     
    - app.hide();
    - 
    +app.hide(); +
    @@ -1449,12 +1476,14 @@ appropriately when it is launched.
    -

    Code example:

     var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
    +

    Code example:

    +var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
     
    - if (reqAppControl) {
    -     console.log("Requester AppID : " + reqAppControl.callerAppId);
    - }
    - 
    +if (reqAppControl) +{ +   console.log("Requester AppID: " + reqAppControl.callerAppId); +} +
    @@ -1505,28 +1534,35 @@ System events do not require an application identifier to be specified. Therefor
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1559,31 +1595,39 @@ System events do not require an application identifier to be specified. Therefor
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1630,14 +1674,16 @@ An application can listen to events from other applications. However, it can onl
    -

    Code example:

     var myCustomData = {
    -   foo: 'bar'
    - };
    +

    Code example:

    +var myCustomData = 
    +{
    +   foo: 'bar'
    +};
     
    - var app = tizen.application.getCurrentApplication();
    +var app = tizen.application.getCurrentApplication();
     
    - app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
    - 
    +app.broadcastEvent({"name": "custom_user_event"}, myCustomData); +
    @@ -1684,14 +1730,16 @@ An application can listen to events from other applications. However, it can onl
    -

    Code example:

     var myTrustedCustomData = {
    -   foo: 'bar'
    - };
    +

    Code example:

    +var myTrustedCustomData = 
    +{
    +   foo: 'bar'
    +};
     
    - var app = tizen.application.getCurrentApplication();
    +var app = tizen.application.getCurrentApplication();
     
    - app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
    - 
    +app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData); +
    @@ -1899,8 +1947,9 @@ between applications through the ApplicationControl interface. 2.0

    -

    Code example:

     var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
    - 
    +

    Code example:

    +var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
    +

    Constructors

    @@ -1963,15 +2012,11 @@ and launches the selected application. 2.0

    -

    Code example:

     var appControl =
    -       new tizen.ApplicationControl(
    -                  "http://tizen.org/appcontrol/operation/view",
    -                  null,
    -                  "image/jpeg",
    -                  null,
    -                  [new tizen.ApplicationControlData("images",
    -                                                    [imagedata1, imagedata2])] );
    - 
    +

    Code example:

    +var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
    +                                              null, "image/jpeg", null,
    +                                              [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
    +

    Constructors

    @@ -2129,17 +2174,20 @@ It contains the information that the calling application passed to launchApp
    -

    Code example:

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

    Code example:

    +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]);
    +   }
    +}
    +
    @@ -2169,16 +2217,19 @@ to perform the requested action.
    -

    Code example:

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

    Code example:

    +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();
    +   }
    +}
    +
    @@ -2310,13 +2361,15 @@ This callback interface specifies a success method with an array of
    -

    Code example:

     function onListInstalledApps(applications) {
    -     for (var i = 0; i < applications.length; i++)
    -         console.log("ID : " + applications[i].id);
    - }
    +

    Code example:

    +function onListInstalledApps(applications)
    +{
    +   for (var i = 0; i < applications.length; i++)
    +      console.log("ID: " + applications[i].id);
    +}
     
    - tizen.application.getAppsInfo(onListInstalledApps);
    - 
    +tizen.application.getAppsInfo(onListInstalledApps); +
    @@ -2370,43 +2423,42 @@ It is used in ApplicationManager.findAppControl().
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2485,35 +2537,34 @@ This callback interface specifies two methods:
    -

    Code example:

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

    Code example:

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

    Methods

    @@ -2582,19 +2633,24 @@ an application is installed, updated, or uninstalled.

    -

    Code example:

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

    Code example:

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

    Methods

    @@ -2732,30 +2788,37 @@ Platform modules will be able to broadcast system events in a future Tizen relea
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/archive.html b/org.tizen.web.apireference/html/device_api/tv/tizen/archive.html index cfe118a..6ae7c4e 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/archive.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/archive.html @@ -462,16 +462,19 @@ In this mode, getEntries(), getEntryByName(), and extractA
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -504,13 +507,15 @@ In this mode, getEntries(), getEntryByName(), and extractA
    -

    Code example:

     function openSuccess(archive) {
    -     operationId = archive.extractAll("downloads/extracted");
    -     tizen.archive.abort(operationId);
    - }
    -
    - tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
    - 
    +

    Code example:

    +function openSuccess(archive)
    +{
    +   operationId = archive.extractAll("downloads/extracted");
    +   tizen.archive.abort(operationId);
    +}
    +
    +tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
    +
    @@ -729,24 +734,29 @@ If the source file is big then the callback can also be called while the file is
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -840,24 +850,29 @@ UnknownError: In any other error case
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -926,23 +941,28 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1017,20 +1037,24 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1234,24 +1258,29 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/content.html b/org.tizen.web.apireference/html/device_api/tv/tizen/content.html index 6535eff..d83fa73 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/content.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/content.html @@ -449,13 +449,15 @@ contain an invalid value.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -530,23 +532,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -597,21 +603,26 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // The following example retrieves content directories in the storage.
    +

    Code example:

    +/* 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);
    - 
    +function getDirectoriesCB(directories) +{ +   directories.forEach(printDirectory); +} + +tizen.content.getDirectories(getDirectoriesCB, errorCB); +
    @@ -698,35 +709,40 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -798,21 +814,24 @@ contain an invalid value (e.g. given contentURI is an empty string).
    -

    Code example:

     // The following example scan 'tizen.jpg' in media directory
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +/* 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');
    +}
     
    - 
    +tizen.filesystem.resolve("images/tizen.jpg", function(imageFile) +{ +   tizen.content.scanFile(imageFile.toURI(), successCB, errorCB); +}); +
    @@ -892,21 +911,24 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

     // The following example scans 'images' directory
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +/* 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');
    +}
     
    - 
    +tizen.filesystem.resolve("images", function(directory) +{ +   tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB); +}); +
    @@ -961,9 +983,9 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

     tizen.content.cancelScanDirectory(directory.toURI());
    -
    - 
    +

    Code example:

    +tizen.content.cancelScanDirectory(directory.toURI());
    +
    @@ -1005,32 +1027,40 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

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

    Code example:

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

    Output example:

     Listener ID: 1
    @@ -1068,34 +1098,42 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1151,31 +1189,38 @@ developers to add a listener and get notified when content is added, removed or
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1215,9 +1260,9 @@ developers to add a listener and get notified when content is added, removed or
    -

    Code example:

     tizen.content.unsetChangeListener();
    -
    - 
    +

    Code example:

    +tizen.content.unsetChangeListener();
    +
    @@ -1276,24 +1321,28 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1362,50 +1411,58 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1468,44 +1525,51 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1570,18 +1634,22 @@ AbortError: In case of any error.
    -

    Code example:

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

    Code example:

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

    Output example:

     The thumbnail path is /home/owner/share/media/.thumb/phone/.jpg-bed1d5f494830f7a52e1217f1e924aff.jpg
    @@ -2819,59 +2887,71 @@ UnknownError: In case of any error              
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2934,69 +3014,82 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3065,38 +3158,46 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3161,74 +3262,89 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3306,69 +3422,84 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/console.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/console.html index e885b95..5c5ceb6 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/console.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/console.html @@ -3,7 +3,7 @@ -Console API +Console API
    @@ -121,8 +121,7 @@ The text will be logged as a standard message.
    -

    Code example:

     console.log('A is for Alice.');
    - 
    +

    Code example:

    console.log('A is for Alice.');

    Output example:

    A is for Alice.
    @@ -153,8 +152,7 @@ The text will be logged as an error message.
             
     
    -

    Code example:

     console.error('B is for Bob.');
    - 
    +

    Code example:

    console.error('B is for Bob.');

    Output example:

    B is for Bob.
    @@ -185,8 +183,7 @@ The text will be logged as a warning message.
             
     
    -

    Code example:

     console.warn('C is for Christopher.');
    - 
    +

    Code example:

    console.warn('C is for Christopher.');

    Output example:

    C is for Christopher.
    @@ -217,8 +214,7 @@ The text will be logged as an info message.
             
     
    -

    Code example:

     console.info('D is for Dorothy.');
    - 
    +

    Code example:

    console.info('D is for Dorothy.');

    Output example:

    D is for Dorothy.
    @@ -249,8 +245,7 @@ The text will be logged as a debug message.
             
     
    -

    Code example:

     console.debug('E is for Eve.');
    - 
    +

    Code example:

    console.debug('E is for Eve.');

    Output example:

    E is for Eve.
    @@ -285,11 +280,12 @@ the message is written to the console.
             
     
    -

    Code example:

     var felix = 'Felix';
    +

    Code example:

    +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.');
    - 
    +/* This assertion checks whether the first letter in name 'Felix' is 'A' */ +console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.'); +

    Output example:

    Felix does not start with A.
    @@ -321,9 +317,10 @@ Object view is forced.
             
     
    -

    Code example:

     var john = {name: "John", surname: "Doe"};
    - console.dir(john.name);
    - 
    +

    Code example:

    +var john = {name: "John", surname: "Doe"};
    +console.dir(john.name);
    +

    Output example:

    John
    @@ -354,9 +351,10 @@ if possible or the JavaScript Object if it is not.
             
     
    -

    Code example:

     var john = {name: "John", surname: "Doe"};
    - console.dirxml(john.surname);
    - 
    +

    Code example:

    +var john = {name: "John", surname: "Doe"};
    +console.dirxml(john.surname);
    +

    Output example:

    Doe
    @@ -388,13 +386,15 @@ is displayed in the console. Timer values are accurate to the sub-millisecond.
             
     
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +

    Output example:

    Big array initialization: 461.989ms
    @@ -424,13 +424,15 @@ is displayed in the console. Timer values are accurate to the sub-millisecond.
             
     
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +

    Output example:

    Big array initialization: 461.989ms
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/cordova.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/cordova.html
    index 09b58a9..9fda036 100644
    --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/cordova.html
    +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/cordova.html
    @@ -3,7 +3,7 @@
     
     
     
    -Cordova API
    +Cordova API
     
     
     
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device-motion.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device-motion.html index d15a2a8..b9a8dc2 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device-motion.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device-motion.html @@ -3,7 +3,7 @@ -DeviceMotion API +DeviceMotion API

    Output example:

    Acceleration X: 0.00
    @@ -197,22 +200,25 @@ Timestamp: 1456480118000
     
             
    -

    Code example:

     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...');
    - };
    +

    Code example:

    +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);
    - 
    +var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options); +

    Output example:

    Acceleration X: 0.00
    @@ -259,26 +265,30 @@ Please wait 3 seconds for the next measurement...
     
             
    -

    Code example:

     var counter = 0, watchID;
    +

    Code example:

    +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);
    - 
    +watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options); +

    Output example:

    Acceleration X: 0.00
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device.html
    index e0e8ab1..5cd870c 100644
    --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device.html
    +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/device.html
    @@ -3,7 +3,7 @@
     
     
     
    -Device API
    +Device API
     
     
     
     
     
     
     
     

    Output example:

    Device Version: 3.0
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/dialogs.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/dialogs.html
    index 0a8e532..5fc7a5a 100644
    --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/dialogs.html
    +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/dialogs.html
    @@ -3,7 +3,7 @@
     
     
     
    -Dialogs API
    +Dialogs API
     
     
     
    @@ -140,13 +140,15 @@ The navigator.notification object allows access to the Dialogs API.
    -

    Code example:

     var alertDismissed = function() {
    -    console.log('Alert was dismissed');
    - }
    +

    Code example:

    +var alertDismissed = function()
    +{
    +   console.log('Alert was dismissed');
    +}
     
    - navigator.notification.alert('Please click OK button', alertDismissed,
    -                              'OK click alert', 'OK');
    - 
    +navigator.notification.alert('Please click OK button', alertDismissed, +                             'OK click alert', 'OK'); +

    Output example:

    Alert was dismissed
    @@ -189,13 +191,15 @@ Callback provides index of button pressed (1,2,3 etc.) or 0, if dialog was dismi
             
     
    -

    Code example:

     var confirmCallback = function(buttonIndex) {
    -    console.log('Selected option was ' + buttonIndex);
    - }
    +

    Code example:

    +var confirmCallback = function(buttonIndex)
    +{
    +   console.log('Selected option was ' + buttonIndex);
    +}
     
    - navigator.notification.confirm('Choose one option', confirmCallback,
    -                              'Options', ['Option1', 'Option2']);
    - 
    +navigator.notification.confirm('Choose one option', confirmCallback, +                               'Options', ['Option1', 'Option2']); +

    Output example:

    Selected option was 1
    @@ -242,16 +246,15 @@ Callback provides PromptData object, which holds all data provided by u
             
     
    -

    Code example:

     var promptCallback = function(results) {
    -    console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
    - }
    +

    Code example:

    +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');
    - 
    +navigator.notification.prompt('Please enter your name', promptCallback, +                              'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe'); +

    Output example:

    Hello Jane Doe, you selected option 1
    @@ -281,10 +284,11 @@ Callback provides PromptData object, which holds all data provided by u
             
     
    -

    Code example:

     var times = 2;
    - console.log('Device would beep ' + times + ' times');
    - navigator.notification.beep(times);
    - 
    +

    Code example:

    +var times = 2;
    +console.log('Device would beep ' + times + ' times');
    +navigator.notification.beep(times);
    +
    @@ -243,16 +245,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova pause event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('pause', onPause, false);
    - }
    -
    - function onPause() {
    -   // Handle the pause event
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('pause', onPause, false);
    +}
    +
    +function onPause()
    +{
    +   /* Handle the pause event */
    +}
    +
    @@ -279,16 +284,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova resume event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('resume', onResume, false);
    - }
    -
    - function onResume() {
    -   // Handle the resume event
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('resume', onResume, false);
    +}
    +
    +function onResume()
    +{
    +   /* Handle the resume event */
    +}
    +
    @@ -313,16 +321,19 @@ It is no longer necessary to call any other method to override the back-button b Original documentation: Cordova backbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('backbutton', onBackKeyDown, false);
    - }
    -
    - function onBackKeyDown() {
    -    // Handle the back button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('backbutton', onBackKeyDown, false);
    +}
    +
    +function onBackKeyDown()
    +{
    +   /* Handle the back button */
    +}
    +
    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('menubutton', onMenuKeyDown, false);
    - }
    -
    - function onMenuKeyDown() {
    -   // Handle the back button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('menubutton', onMenuKeyDown, false);
    +}
    +
    +function onMenuKeyDown()
    +{
    +   /* Handle the back button */
    +}
    +
    @@ -385,16 +399,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova searchbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('searchbutton', onSearchKeyDown, false);
    - }
    -
    - function onSearchKeyDown() {
    -   // Handle the search button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('searchbutton', onSearchKeyDown, false);
    +}
    +
    +function onSearchKeyDown()
    +{
    +   /* Handle the search button */
    +}
    +
    @@ -421,16 +438,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova startcallbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('startcallbutton', onStartCallKeyDown, false);
    - }
    -
    - function onStartCallKeyDown() {
    -   // Handle the start call button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('startcallbutton', onStartCallKeyDown, false);
    +}
    +
    +function onStartCallKeyDown()
    +{
    +   /* Handle the start call button */
    +}
    +
    @@ -457,16 +477,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova endcallbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('endcallbutton', onEndCallKeyDown, false);
    - }
    -
    - function onEndCallKeyDown() {
    -   // Handle the end call button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('endcallbutton', onEndCallKeyDown, false);
    +}
    +
    +function onEndCallKeyDown()
    +{
    +   /* Handle the end call button */
    +}
    +
    @@ -493,16 +516,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova volumedownbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
    - }
    -
    - function onVolumeDownKeyDown() {
    -   // Handle the volume down button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
    +}
    +
    +function onVolumeDownKeyDown()
    +{
    +   /* Handle the volume down button */
    +}
    +
    @@ -529,16 +555,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova volumeupbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
    - }
    -
    - function onVolumeUpKeyDown() {
    -   // Handle the volume up button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
    +}
    +
    +function onVolumeUpKeyDown()
    +{
    +   /* Handle the volume up button */
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/file.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/file.html index eb4bf70..4eabbc4 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/file.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/file.html @@ -3,7 +3,7 @@ -File API +File API

    Constructors

    @@ -501,8 +503,7 @@ This manager interface exposes the Filesystem base API constants. 3.0

    -

    Code example:

     console.log("The directory where the application is installed " + cordova.file.applicationDirectory);
    - 
    +

    Code example:

    console.log("The directory where the application is installed " + cordova.file.applicationDirectory);

    Output example:

    The directory where the application is installed file:///opt/usr/apps/WfigBlWDyf/res/wgt/
    @@ -519,8 +520,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);
    - 
    +

    Code example:

    console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);

    Output example:

    Root directory of the application's sandbox file:///opt/usr/apps/WfigBlWDyf/
    @@ -537,8 +537,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Data directory " + cordova.file.dataDirectory);
    - 
    +

    Code example:

    console.log("Data directory " + cordova.file.dataDirectory);

    Output example:

    Data directory file:///opt/usr/apps/WfigBlWDyf/data/
    @@ -555,8 +554,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Cache directory " + cordova.file.cacheDirectory);
    - 
    +

    Code example:

    console.log("Cache directory " + cordova.file.cacheDirectory);

    Output example:

    Cache directory file:///opt/usr/apps/WfigBlWDyf/tmp/
    @@ -573,8 +571,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);
    - 
    +

    Code example:

    console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);

    Output example:

    Space on external storage null
    @@ -591,8 +588,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Data files on external storage " + cordova.file.externalDataDirectory);
    - 
    +

    Code example:

    console.log("Data files on external storage " + cordova.file.externalDataDirectory);

    Output example:

    Data files on external storage null
    @@ -609,8 +605,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Cache on external storage " + cordova.file.externalCacheDirectory);
    - 
    +

    Code example:

    console.log("Cache on external storage " + cordova.file.externalCacheDirectory);

    Output example:

    Cache on external storage null
    @@ -627,8 +622,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Root on external storage " + cordova.file.externalRootDirectory);
    - 
    +

    Code example:

    console.log("Root on external storage " + cordova.file.externalRootDirectory);

    Output example:

    Root on external storage file:///usr/storage/sdcard/
    @@ -645,8 +639,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Temp directory " + cordova.file.tempDirectory);
    - 
    +

    Code example:

    console.log("Temp directory " + cordova.file.tempDirectory);

    Output example:

    Temp directory null
    @@ -663,8 +656,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Synced data directory " + cordova.file.syncedDataDirectory);
    - 
    +

    Code example:

    console.log("Synced data directory " + cordova.file.syncedDataDirectory);

    Output example:

    Synced data directory null
    @@ -681,8 +673,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Documents directory " + cordova.file.documentsDirectory);
    - 
    +

    Code example:

    console.log("Documents directory " + cordova.file.documentsDirectory);

    Output example:

    Documents directory null
    @@ -699,8 +690,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Files globally available to all applications " + cordova.file.sharedDirectory);
    - 
    +

    Code example:

    console.log("Files globally available to all applications " + cordova.file.sharedDirectory);

    Output example:

    Files globally available to all applications file:///opt/usr/media/
    @@ -743,10 +733,12 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
      3.0
                 

    -

    Code example:

     requestFileSystem(TEMPORARY, 100, function (fileSystem) {
    -        console.log('Name of the filesystem: '+fileSystem.name);
    - });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fileSystem)
    +{
    +   console.log('Name of the filesystem: ' + fileSystem.name);
    +});
    +

    Output example:

    Name of the filesystem: temporary
    @@ -1007,17 +999,19 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

     successCallback = function(fs) {
    -     console.log('File system name ' + fs.name);
    - };
    -
    - errorCallback = function(err) {
    -     console.log(err.code);
    - };
    -
    - requestFileSystem(TEMPORARY, 1024*1024, successCallback, errorCallback);
    -
    - 
    +

    Code example:

    +successCallback = function(fs)
    +{
    +   console.log('File system name ' + fs.name);
    +};
    +
    +errorCallback = function(err)
    +{
    +   console.log(err.code);
    +};
    +
    +requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
    +

    Output example:

    File system name temporary
    @@ -1070,18 +1064,20 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Entry name example.txt
    @@ -1224,12 +1220,15 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getMetadata(function (metadata) {
    -       console.log("Last modification time: " + metadata.modificationTime);// get metadata successfully
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getMetadata(function(metadata)
    +   {
    +      console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
    +   });
    +});
    +

    Output example:

    Last modification time: Fri Jan 02 2015 03:58:08 GMT+0900 (KST)
    @@ -1311,16 +1310,21 @@ A move of a directory on top of an existing empty directory must attempt to dele
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Full path before move: /aa.txt
    @@ -1404,18 +1408,20 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Full path to the copied file: /testDirectory/newname.txt
    @@ -1464,12 +1470,15 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getParent(function (entry) {
    -       console.log("success");
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getParent(function(entry)
    +   {
    +      console.log("success");
    +   });
    +});
    +

    Output example:

    success
    @@ -1522,14 +1531,18 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile('test.txt', {create: true}, function(fileEntry) {
    -       fileEntry.remove(function () {
    -         console.log("success");
    -       });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile('test.txt', {create: true}, function(fileEntry)
    +   {
    +      fileEntry.remove(function()
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -1554,14 +1567,16 @@ Directory copies are always recursive--that is, they copy all contents of the di
      URL that can be used to identify this entry.
                   
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory('testDirectory', {create:true},
    -       function(entry) {
    -         var url = entry.toURL();
    -         console.log('URL: '+url);
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory('testDirectory', {create:true}, function(entry)
    +   {
    +      var url = entry.toURL();
    +      console.log('URL: ' + url);
    +   });
    +});
    +

    Output example:

    URL: file:///home/owner/apps_rw/WfigBlWDyf/tmp/testDirectory/
    @@ -1620,12 +1635,15 @@ Directory copies are always recursive--that is, they copy all contents of the di
      DirectoryReader
                   
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function (entry) {
    -     entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry) {
    -          var directoryReader = dirEntry.createReader();
    -      });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(entry)
    +{
    +   entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
    +   {
    +      var directoryReader = dirEntry.createReader();
    +   });
    +});
    +
    @@ -1696,12 +1714,15 @@ Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry c
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory("ert",{create:true},function(dir){
    -         console.log('Created dir: '+dir.name);
    -      })
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory("ert", {create:true}, function(dir)
    +   {
    +      console.log('Created dir: ' + dir.name);
    +   })
    +});
    +

    Output example:

    Created dir: ert
    @@ -1776,12 +1797,15 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile("qa.txt",{create:true},function(file){
    -           console.log('Created file: '+file.name);
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile("qa.txt", {create:true}, function(file)
    +   {
    +      console.log('Created file: ' + file.name);
    +   });
    +});
    +

    Output example:

    Created file: qa.txt
    @@ -1834,15 +1858,18 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory("testDirectory", {create:true},
    -       function(directoryEntry) {
    -         directoryEntry.removeRecursively(function() {
    -           console.log("success");
    -         });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
    +   {
    +      directoryEntry.removeRecursively(function()
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -1906,13 +1933,16 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     var a = fs.root.createReader();
    -     a.readEntries(function successCallback(entries) {
    -       console.log("success");
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   var a = fs.root.createReader();
    +   a.readEntries(function successCallback(entries)
    +   {
    +      console.log("success");
    +   });
    +});
    +

    Output example:

    success
    @@ -1976,20 +2006,26 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
             
     
    -

    Code example:

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

    Code example:

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

    Output example:

    success
    @@ -2031,14 +2067,18 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
             
     
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile("abcdz.txt", {create: true}, function (f) {
    -       f.file(function (file) {
    -         console.log("success");
    -       });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile("abcdz.txt", {create: true}, function(f)
    +   {
    +      f.file(function(file)
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -2090,12 +2130,14 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
      3.0
               

    -

    Code example:

     var deviceReady, fileReader;
    - deviceReady = function() {
    -     fileReader = new FileReader();
    - };
    - document.addEventListener('deviceready', deviceReady, true);
    - 
    +

    Code example:

    +var deviceReady, fileReader;
    +deviceReady = function()
    +{
    +   fileReader = new FileReader();
    +};
    +document.addEventListener('deviceready', deviceReady, true);
    +

    Constructors

    @@ -2236,17 +2278,20 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read 3.0

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +

    Output example:

    aborted
    @@ -2295,13 +2340,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    -  fileReader.readAsDataURL(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsDataURL(blob);
    +

    Output example:

    Loaded, result = data:;base64,YWJj
    @@ -2354,13 +2401,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    - fileReader.readAsText(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsText(blob);
    +

    Output example:

    Loaded, result = abc
    @@ -2409,13 +2458,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    - fileReader.readAsBinaryString(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsBinaryString(blob);
    +

    Output example:

    Loaded, result = abc
    @@ -2464,14 +2515,16 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     resultValue = fileReader.result;
    -      console.log("Result: "+resultValue.toString()+'
    '+'ByteLength: '+resultValue.byteLength); - }; - fileReader.readAsArrayBuffer(blob); -
    +

    Code example:

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

    Output example:

    Result: [object ArrayBuffer]
    @@ -2660,24 +2713,29 @@ ByteLength: 3
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    abort
    @@ -2719,18 +2777,21 @@ If the offset is a negative number the position of the file pointer is rewound.
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2771,21 +2832,25 @@ If the offset is a negative number the position of the file pointer is rewound.
    -

    Code example:

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

    Code example:

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

    Output example:

    truncate success
    @@ -2834,21 +2899,25 @@ If the offset is a negative number the position of the file pointer is rewound.
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    write success
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/filetransfer.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/filetransfer.html
    index 5ee979b..c65e95b 100644
    --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/filetransfer.html
    +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/filetransfer.html
    @@ -3,7 +3,7 @@
     
     
     
    -FileTransfer API
    +FileTransfer API
     
     
     
    @@ -169,34 +169,37 @@ The key / value type of download options values. Currently only supports header 3.0

    -

    Code example:

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

    Code example:

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

    Output example:

    Code = 200
    @@ -209,9 +212,10 @@ Sent = 1024
     
    FileUploadOptions(DOMString fileKey, DOMString fileName, DOMString mimeType, FileUploadParams params, HeaderFields headers, DOMString httpMethod);
    -

    Code example:

     // Creates a FileUploadOptions object.
    - var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
    - 
    +

    Code example:

    +/* Creates a FileUploadOptions object */
    +var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
    +
    @@ -502,9 +506,10 @@ Sent = 1024
    FileTransfer();
    -

    Code example:

     // Creates a FileTransfer object.
    - var file_transfer = new FileTransfer();
    - 
    +

    Code example:

    +/* Creates a FileTransfer object */
    +var file_transfer = new FileTransfer();
    +
    @@ -519,32 +524,36 @@ Sent = 1024 3.0

    -

    Code example:

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

    Code example:

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

    Output example:

    uploaded: 512
     uploaded: 1024
    -Success.  File uploaded.
    +Success. File uploaded.
     
    @@ -607,23 +616,26 @@ Success. File uploaded.
    -

    Code example:

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

    Code example:

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

    Output example:

    Code = 200
    @@ -687,30 +699,28 @@ Sent = 1024
             
     
    -

    Code example:

     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=='
    -     }
    -   }
    - );
    - 
    +

    Code example:

    +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=='
    +   }
    +});
    +

    Output example:

    download complete: file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
    @@ -739,26 +749,29 @@ Sent = 1024
      http://tizen.org/privilege/internet
                 

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +
    -

    Output example:

    An error has occured: Code = 4
    +

    Output example:

    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
     
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/globalization.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/globalization.html index 98aed77..afad5a6 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/globalization.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/globalization.html @@ -3,7 +3,7 @@ -Globalization API +Globalization API
    @@ -263,15 +263,20 @@ during this method's execution.
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    Language: en-US
    @@ -323,15 +328,20 @@ occuring while getting a locale name.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    Locale: en-US
    @@ -387,17 +397,20 @@ passed as a parameter to the successCallback.
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    Date: 9/25/2012 4:21PM
    @@ -450,24 +463,25 @@ for example 'USD'.
     
             
    -

    Code example:

     // 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.'); }
    - );
    -
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    pattern: $#,##0.##;($#,##0.##)
    @@ -527,20 +541,23 @@ The default value is {type: 'wide', item: 'months'}                
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    month: January
    @@ -604,20 +621,25 @@ The default value is {formatLength: 'short', selector: 'date and time'}
             
    -

    Code example:

     // 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();
    - 
    +

    Code example:

    +/*
    +   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();
    +

    Output example:

    Date pattern: M/d/yyyy h:mm a
    @@ -667,14 +689,19 @@ the first day of a week.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    day: 1
    @@ -729,26 +756,26 @@ the pattern will be returned.
     
             
    -

    Code example:

     // 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' }
    - );
    -
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    pattern: #,##0.###
    @@ -811,16 +838,19 @@ errors occuring during this method's execution.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    dst: true
    @@ -884,37 +914,43 @@ The default value of this parameter is {type: 'decimal'}.
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    decimal number: 3.142
    @@ -973,22 +1009,23 @@ The default value is {formatLength: 'short', selector: 'date and time'}
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    month: 8, day: 25, year: 2012
    @@ -1047,16 +1084,19 @@ The default value is {type: 'decimal'}                
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    number: 1234.56
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/media.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/media.html
    index 68dabe1..e62cde0 100644
    --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/media.html
    +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/media.html
    @@ -3,7 +3,7 @@
     
     
     
    -Media API
    +Media API
     
     
     
     
     

    Output example:

    Audio file has been played back.
    @@ -290,20 +294,23 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio duration is 281.035
    @@ -324,31 +331,36 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio file has been paused.
    @@ -369,19 +381,22 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

     successCallback = function() {
    -    console.log('Audio file has been played back.');
    - }
    +

    Code example:

    +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();
    - 
    +myMedia.play(); +

    Output example:

    Audio file has been played back.
    @@ -403,21 +418,24 @@ Applications should call the release function for any Media resource that is no
      3.0
                 

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +

    Output example:

    Audio file has been stopped or released.
    @@ -448,24 +466,28 @@ Audio file has been stopped or released.
             
     
    -

    Code example:

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

    Code example:

    +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);
      
    @@ -505,31 +527,36 @@ Audio file has been played back.
    -

    Code example:

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

    Code example:

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

    Output example:

    Playback volume has been muted.
    @@ -560,19 +587,22 @@ Audio file has been played back.
      http://tizen.org/privilege/mediacapture
                 

    -

    Code example:

     successCallback = function() {
    -    console.log('Started recording an audio file.');
    - }
    +

    Code example:

    +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();
    - 
    +myRecMedia.startRecord(); +

    Output example:

    Started recording an audio file.
    @@ -601,25 +631,29 @@ Audio file has been played back.
      http://tizen.org/privilege/mediacapture
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Started recording an audio file.
    @@ -641,24 +675,28 @@ Stopped recording an audio file.
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio playback has been stopped.
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/networkInformation.html b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/networkInformation.html
    index 5f64956..2cb1438 100644
    --- a/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/networkInformation.html
    +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/cordova/networkInformation.html
    @@ -3,7 +3,7 @@
     
     
     
    -NetworkInformation API
    +NetworkInformation API
     
     
     
    @@ -112,23 +112,25 @@ The navigator.connection object allows access to the NetworkInformation http://tizen.org/privilege/telephony

    -

    Code example:

     function checkConnection() {
    -   var networkState = navigator.connection.type;
    +

    Code example:

    +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();
    - 
    +checkConnection(); +

    Output example:

    Connection type: Cell 3G connection
    @@ -165,8 +167,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.UNKNOWN);
    - 
    +

    Code example:

    console.log(Connection.UNKNOWN);

    Output example:

    unknown
    @@ -183,8 +184,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.ETHERNET);
    - 
    +

    Code example:

    console.log(Connection.ETHERNET);

    Output example:

    ethernet
    @@ -201,8 +201,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.WIFI);
    - 
    +

    Code example:

    console.log(Connection.WIFI);

    Output example:

    wifi
    @@ -219,8 +218,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_2G);
    - 
    +

    Code example:

    console.log(Connection.CELL_2G);

    Output example:

    2g
    @@ -237,8 +235,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_3G);
    - 
    +

    Code example:

    console.log(Connection.CELL_3G);

    Output example:

    3g
    @@ -255,8 +252,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_4G);
    - 
    +

    Code example:

    console.log(Connection.CELL_4G);

    Output example:

    4g
    @@ -273,8 +269,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL);
    - 
    +

    Code example:

    console.log(Connection.CELL);

    Output example:

    cellular
    @@ -291,8 +286,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.NONE);
    - 
    +

    Code example:

    console.log(Connection.NONE);

    Output example:

    none
    @@ -326,16 +320,19 @@ Applications typically should use document.addEventListener() to attach an event
     Original documentation: Cordova online event          

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    +

    Code example:

    +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
    - }
    - 
    +function onOnline() +{ +   /* Handle the online event */ +} +
    @@ -362,16 +359,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova offline event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    +

    Code example:

    +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
    - }
    - 
    +function onOffline() +{ +   /* Handle the offline event */ +} +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/datacontrol.html b/org.tizen.web.apireference/html/device_api/tv/tizen/datacontrol.html index b352277..db24537 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/datacontrol.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/datacontrol.html @@ -231,25 +231,34 @@ DataControl API.
    -

    Code example:

     //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.
    +

    Code example:

    +/* 
    +   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);
    - }
    - 
    +/* 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); +} +
    @@ -401,29 +410,34 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id, insertRowId)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    @@ -494,29 +508,34 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    @@ -583,25 +602,29 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -692,46 +715,49 @@ If either of the page or maxNumberPerPage parameters are set t
    -

    Code example:

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

    Code example:

    +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);
    - }
    -
    - 
    +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); +} +
    @@ -835,25 +861,29 @@ If either of the page or maxNumberPerPage parameters are set t
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -927,25 +957,29 @@ If either of the page or maxNumberPerPage parameters are set t
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -1015,25 +1049,29 @@ If either of the page or maxNumberPerPage parameters are set t
    -

    Code example:

     function getValueSuccessCB(result, id)
    - {
    -     console.log(result.length + ":" + result[0]);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -1111,25 +1149,29 @@ If either of the page or maxNumberPerPage parameters are set t
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/download.html b/org.tizen.web.apireference/html/device_api/tv/tizen/download.html index 3f18286..5ddacc0 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/download.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/download.html @@ -287,11 +287,12 @@ The default value is an empty object. 2.1

    -

    Code example:

     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";
    - 
    +

    Code example:

    +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";
    +
    @@ -392,47 +393,59 @@ If the network is not available for downloading, the return value is -1 since Ti
    -

    Code example:

     // 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;
    - }
    +

    Code example:

    +/* 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");
     
    - 
    +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."); +} +
    @@ -476,9 +489,10 @@ If the network is not available for downloading, the return value is -1 since Ti
    -

    Code example:

     // Cancels the ongoing download operation with the specified ID.
    - tizen.download.cancel(downloadId);
    - 
    +

    Code example:

    +/* Cancels the ongoing download operation with the specified ID */
    +tizen.download.cancel(downloadId);
    +
    @@ -523,9 +537,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Pauses the ongoing download operation with the specified ID.
    - tizen.download.pause(downloadId);
    - 
    +

    Code example:

    +/* Pauses the ongoing download operation with the specified ID */
    +tizen.download.pause(downloadId);
    +
    @@ -569,9 +584,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Resumes the paused download operation with the specified ID.
    - tizen.download.resume(downloadId);
    - 
    +

    Code example:

    +/* Resumes the paused download operation with the specified ID */
    +tizen.download.resume(downloadId);
    +
    @@ -619,9 +635,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Gets the state of the download operation with the given ID.
    - var state = tizen.download.getState(downloadId);
    - 
    +

    Code example:

    +/* Gets the state of the download operation with the given ID */
    +var state = tizen.download.getState(downloadId);
    +
    @@ -672,9 +689,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Gets the download request information with the given ID.
    - var downloadRequest = tizen.download.getDownloadRequest(downloadId);
    - 
    +

    Code example:

    +/* Gets the download request information with the given ID */
    +var downloadRequest = tizen.download.getDownloadRequest(downloadId);
    +
    @@ -729,9 +747,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Get the MIME type of the download operation with the given ID.
    - var MIMEtype = tizen.download.getMIMEType(downloadId);
    - 
    +

    Code example:

    +/* Get the MIME type of the download operation with the given ID */
    +var MIMEtype = tizen.download.getMIMEType(downloadId);
    +
    @@ -783,31 +802,38 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    - 
    +/* Add the listener */ +tizen.download.setListener(downloadId, listener); +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/exif.html b/org.tizen.web.apireference/html/device_api/tv/tizen/exif.html index a3ce8ba..29ade94 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/exif.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/exif.html @@ -253,27 +253,33 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -327,41 +333,47 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -422,33 +434,39 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    - 
    +

    Code example:

    +/* 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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/filesystem.html b/org.tizen.web.apireference/html/device_api/tv/tizen/filesystem.html index ef65112..d95e484 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/filesystem.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/filesystem.html @@ -368,41 +368,44 @@ as determining root and default locations, resolving a given location into a fil

    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +

    Attributes

    @@ -416,8 +419,9 @@ as determining root and default locations, resolving a given location into a fil 1.0

    -

    Code example:

     console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
    - 
    +

    Code example:

    +console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
    +
    @@ -532,15 +536,15 @@ UnknownError - If any other error occurs.
    -

    Code example:

     tizen.filesystem.resolve(
    -   'images',
    -   function(dir) {
    -     console.log("Mount point Name is " +  dir.path);
    -   }, function(e) {
    -     console.log("Error: " + e.message);
    -   }, "r"
    - );
    - 
    +

    Code example:

    +tizen.filesystem.resolve('images', function(dir)
    +{
    +   console.log("Mount point Name is " +  dir.path);
    +}, function(e)
    +{
    +   console.log("Error: " + e.message);
    +}, "r");
    +
    @@ -610,16 +614,19 @@ UnknownError - If any other error occurs.
    -

    Code example:

     function onStorage(storage) {
    -     // Do something
    - }
    +

    Code example:

    +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);
    - 
    +tizen.filesystem.getStorage("music", onStorage, onStorageError); +
    @@ -685,17 +692,20 @@ UnknownError - If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -763,14 +773,16 @@ The watch operation must continue until the removeStorageStateChangeListener() m
    -

    Code example:

     var watchID;
    - function onStorageStateChanged(storage) {
    -     if (storage.state == "MOUNTED")
    -         console.log("Storage " + storage.label + " was added!");
    - }
    +

    Code example:

    +var watchID;
    +function onStorageStateChanged(storage)
    +{
    +   if (storage.state == "MOUNTED")
    +      console.log("Storage " + storage.label + " was added!");
    +}
     
    - watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
    - 
    +watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged); +
    @@ -822,16 +834,17 @@ Otherwise, the method call has no effect.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -995,21 +1008,25 @@ files and directories rooted as the file handle location.

    -

    Code example:

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

    Code example:

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

    Attributes

    @@ -1029,23 +1046,29 @@ This attribute is set tonull if there is no parent directory. This al 1.0

    -

    Code example:

     // 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");
    - }
    - 
    +

    Code example:

    +/* 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");
    +}
    +
  • @@ -1072,22 +1095,26 @@ This attribute represents the actual state of a file or directory in the filesys 1.0

    -

    Code example:

     // 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");
    - }
    - 
    +

    Code example:

    +/* 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");
    +}
    +
  • @@ -1177,8 +1204,7 @@ timestamp changes when a file is moved. 1.0

    -

    Code example:

     console.log(file.modified); // displays the modification timestamp
    - 
    +

    Code example:

    console.log(file.modified); /* Displays the modification timestamp */
  • @@ -1212,8 +1238,7 @@ For example, if the root is music, then the path is music. If the root is docume 1.0

    -

    Code example:

     console.log(file.path); // should be 'music/' if the file is music/foo.mp3
    - 
    +

    Code example:

    console.log(file.path); /* Must be 'music/' if the file is music/foo.mp3 */
  • @@ -1242,9 +1267,10 @@ For the special case of the root itself, the name is an empty string. 1.0

    -

    Code example:

     // should be foo.mp3 if the file path is music/foo.mp3
    - console.log(file.name);
    - 
    +

    Code example:

    +/* Must be foo.mp3 if the file path is music/foo.mp3 */
    +console.log(file.name);
    +
  • @@ -1275,9 +1301,10 @@ The fullPath is always equal to path + name. 1.0

    -

    Code example:

      // should be music/track1.mp3 if the file is music/track1.mp3
    - console.log(file.fullPath);
    - 
    +

    Code example:

    +/* Must be music/track1.mp3 if the file is music/track1.mp3 */
    +console.log(file.fullPath);
    +
  • @@ -1295,9 +1322,10 @@ If an attempt to read this attribute for a directory is made, undefined
    -

    Code example:

     // displays the file size
    - console.log(file.fileSize);
    - 
    +

    Code example:

    +/* Displays the file size */
    +console.log(file.fileSize);
    +
  • @@ -1315,9 +1343,10 @@ If an attempt to read this attribute for a file is made, undefined is 1.0

    -

    Code example:

     // '3' if the directory contains two files and one sub-directory
    - console.log(file.length);
    - 
    +

    Code example:

    +/* '3' if the directory contains two files and one sub-directory */
    +console.log(file.length);
    +
  • @@ -1376,12 +1405,14 @@ These URIs must not be accessible to other widgets, apart from the one invoking
    -

    Code example:

     tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file) {
    -   var audio = new Audio(file.toURI());
    -   audio.play();
    -   console.log(file.toURI());
    - });
    - 
    +

    Code example:

    +tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
    +{
    +   var audio = new Audio(file.toURI());
    +   audio.play();
    +   console.log(file.toURI());
    +});
    +
    @@ -1457,23 +1488,25 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1546,39 +1579,43 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1648,35 +1685,40 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1763,33 +1805,36 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1876,33 +1921,36 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1979,10 +2027,11 @@ The new File object has "rw" access rights, as it inherits this from th
    -

    Code example:

     var dir; //Directory object obtained from filesystem API
    - var newDir = dir.createDirectory("newDir");
    - var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
    - 
    +

    Code example:

    +var dir; /* Directory object obtained from filesystem API */
    +var newDir = dir.createDirectory("newDir");
    +var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
    +
    @@ -2054,8 +2103,7 @@ called.
    -

    Code example:

     var newFile = dir.createFile("newFilePath");
    - 
    +

    Code example:

    var newFile = dir.createFile("newFilePath");
    @@ -2126,15 +2174,20 @@ The new File object inherits its access rights from the File o
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +
    @@ -2217,36 +2270,39 @@ all data in all subdirectories and so needs to be used with caution.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -2318,35 +2374,39 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -2537,10 +2597,12 @@ If set to false, this attribute indicates that the file pointer is no 1.0

    -

    Code example:

     if (stream.eof) {
    -   // file has been read completely
    - }
    - 
    +

    Code example:

    +if (stream.eof)
    +{
    +   /* File has been read completely */
    +}
    +
  • @@ -2557,11 +2619,14 @@ The stream position is an offset of bytes from the start of the file stream. Whe 1.0

    -

    Code example:

     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;
    - 
    +

    Code example:

    +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;
    +
  • @@ -2583,8 +2648,8 @@ It corresponds to the number of bytes available after the file pointer denoted b 1.0

    -

    Code example:

     console.log(stream.bytesAvailable); // displays the available bytes to be read
    - 
    +

    Code example:

    +console.log(stream.bytesAvailable); /* Displays the available bytes to be read */
  • @@ -2620,8 +2685,9 @@ Note that pending writes might not succeed. http://tizen.org/privilege/filesystem.read

    -

    Code example:

     stream.close(); // closes this stream, no subsequent access to stream allowed
    - 
    +

    Code example:

    +stream.close(); /* Closes this stream, no subsequent access to stream allowed */
    +
    @@ -2678,9 +2744,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     var text = stream.read(file.fileSize);
    - stream.close();
    - 
    +

    Code example:

    +var text = stream.read(file.fileSize);
    +stream.close();
    +
    @@ -2736,12 +2803,14 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     // 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
    - }
    - 
    +

    Code example:

    +/* 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 */
    +}
    +
    @@ -2797,9 +2866,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     // reads up to 256 bytes from the stream
    - var base64 = stream.readBase64(256);
    - 
    +

    Code example:

    +/* Reads up to 256 bytes from the stream */
    +var base64 = stream.readBase64(256);
    +
    @@ -2848,9 +2918,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     var text = "Hello world";
    - stream.write(text);
    - 
    +

    Code example:

    +var text = "Hello world";
    +stream.write(text);
    +
    @@ -2900,10 +2971,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var bytes = in.readBytes(256);
    - // writes the bytes read from in to out
    - out.writeBytes(bytes);
    - 
    +

    Code example:

    +var bytes = in.readBytes(256);
    +/* Writes the bytes read from in to out */
    +out.writeBytes(bytes);
    +
    @@ -2953,10 +3025,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var base64 = in.readBase64(256);
    - // writes the base64 data read from in to out
    - out.writeBase64(base64);
    - 
    +

    Code example:

    +var base64 = in.readBase64(256);
    +/* Writes the base64 data read from in to out */
    +out.writeBase64(base64);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/keymanager.html b/org.tizen.web.apireference/html/device_api/tv/tizen/keymanager.html index ed19888..67322fd 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/keymanager.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/keymanager.html @@ -219,14 +219,16 @@ Warning: http://tizen.org/privilege/keymanager (public level privilege) MUST NOT
    -

    Code example:

     var data_name = "data1", raw_data = "my data";
    +

    Code example:

    +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);
    - 
    +tizen.keymanager.saveData(data_name, raw_data, null, onSave); +
    @@ -280,31 +282,36 @@ Warning: http://tizen.org/privilege/keymanager (public level privilege) MUST NOT
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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]);
    +}
    +
    @@ -369,30 +376,36 @@ Warning: http://tizen.org/privilege/keymanager (public level privilege) MUST NOT
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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");
    +}
    +
    @@ -425,14 +438,16 @@ Warning: http://tizen.org/privilege/keymanager (public level privilege) MUST NOT
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -500,41 +515,53 @@ Warning: http://tizen.org/privilege/keymanager (public level privilege) MUST NOT
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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");
    +   }
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/messageport.html b/org.tizen.web.apireference/html/device_api/tv/tizen/messageport.html index 794587f..62d0df7 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/messageport.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/messageport.html @@ -239,9 +239,10 @@ The tizen.messageport object allows access to the functionality of the
    -

    Code example:

     // Requests the LocalMessagePort instance with the specified message port name
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - 
    +

    Code example:

    +/* Requests the LocalMessagePort instance with the specified message port name */
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +
    @@ -291,9 +292,10 @@ Trusted local message port can communicate with applications that are signed wit
    -

    Code example:

     // Requests the LocalMessagePort instance with the specified message port name
    - var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
    - 
    +

    Code example:

    +/* Requests the LocalMessagePort instance with the specified message port name */
    +var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
    +
    @@ -344,9 +346,10 @@ If the message port name and application ID are the same, the platform returns t
    -

    Code example:

     // Requests the RemoteMessagePort instance with the specified message port name
    - var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
    - 
    +

    Code example:

    +/* Requests the RemoteMessagePort instance with the specified message port name */
    +var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
    +
    @@ -401,9 +404,10 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     // Requests the RemoteMessagePort instance with the specified message port name.
    - var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
    - 
    +

    Code example:

    +/* Requests the RemoteMessagePort instance with the specified message port name */
    +var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
    +
    @@ -498,13 +502,15 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     function onreceived(data, remoteMsgPort) {
    -   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    - }
    +

    Code example:

    +function onreceived(data, remoteMsgPort)
    +{
    +   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    +}
     
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - 
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA'); +var watchId = localMsgPort.addMessagePortListener(onreceived); +
    @@ -548,11 +554,13 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - // Communication routines of your app...
    - localMsgPort.removeMessagePortListener(watchId);
    - 
    +

    Code example:

    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +var watchId = localMsgPort.addMessagePortListener(onreceived);
    +/* Communication routines of your app */
    +
    +localMsgPort.removeMessagePortListener(watchId);
    +
    @@ -666,30 +674,34 @@ array must not be duplicated or empty.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -765,14 +777,16 @@ array must not be duplicated or empty.
    -

    Code example:

     // MessagePortCallback instance
    - function onreceived(data, remoteMsgPort) {
    -   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    - }
    -
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - 
    +

    Code example:

    +/* MessagePortCallback instance */
    +function onreceived(data, remoteMsgPort)
    +{
    +   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    +}
    +
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +var watchId = localMsgPort.addMessagePortListener(onreceived);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/package.html b/org.tizen.web.apireference/html/device_api/tv/tizen/package.html index 17b4866..3f9434b 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/package.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/package.html @@ -232,31 +232,34 @@ UnknownError - If it is not allowed to install the package by the platform or an
    -

    Code example:

     var onInstallation = {
    -      onprogress: function(packageId, percentage) {
    -         console.log("On installation(" + packageId + ") : progress(" + percentage + ")");
    -      },
    -      oncomplete: function(packageId) {
    -         console.log("Installation(" + packageId + ") Complete");
    -      }
    - }
    +

    Code example:

    +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");
    -
    - 
    +/* 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"); +
    @@ -327,22 +330,27 @@ UnknownError - If it is not allowed to uninstall the package from the platform o
    -

    Code example:

     var onUninstallation = {
    -      onprogress: function(packageId, percentage) {
    -         console.log("On Uninstallation(" + packageId + ") : progress(" + percentage + ")");
    -      },
    -      oncomplete: function(packageId) {
    -         console.log("Uninstallation(" + packageId + ") Complete");
    -      }
    - };
    +

    Code example:

    +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);
    - 
    +/* Let's assume that the package ID to uninstall is "testapp001" */ +tizen.package.uninstall("testapp001", onUninstallation, onError); +
    @@ -404,16 +412,20 @@ UnknownError - If any other platform error occurs.
    -

    Code example:

     function onListInstalledPackages(packages) {
    -     for (var i = 0; i < packages.length; i++) {
    -         console.log("Package id["+i+"] : " +packages[i].id);
    -     }
    - }
    +

    Code example:

    +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);});
    - 
    +tizen.package.getPackagesInfo(onListInstalledPackages, function(err) +{ +   console.log("Can't obtain packages list" + err.name); +}); +
    @@ -475,10 +487,11 @@ The list of installed packages and their package IDs is obtained using getPa
    -

    Code example:

     var packageInfo = tizen.package.getPackageInfo(null);
    +

    Code example:

    +var packageInfo = tizen.package.getPackageInfo(null);
     
    - console.log("Current Package ID : " + packageInfo.id);
    - 
    +console.log("Current Package ID: " + packageInfo.id); +
    @@ -535,20 +548,25 @@ The callback lasts until the unsetPackageInfoEventListener() method is
    -

    Code example:

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

    Code example:

    +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);
    - 
    +tizen.package.setPackageInfoEventListener(packageEventCallback); +
    @@ -585,8 +603,9 @@ The callback lasts until the unsetPackageInfoEventListener() method is
    -

    Code example:

     tizen.package.unsetPackageInfoEventListener();
    - 
    +

    Code example:

    +tizen.package.unsetPackageInfoEventListener();
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/systeminfo.html b/org.tizen.web.apireference/html/device_api/tv/tizen/systeminfo.html index c051247..6ee4b08 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/systeminfo.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/systeminfo.html @@ -666,9 +666,10 @@ and for subscribing notifications of system information changes.
    -

    Code example:

     // To get total amount of system memory
    - console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
    - 
    +

    Code example:

    +/* To get total amount of system memory */
    +console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
    +
    @@ -692,9 +693,10 @@ and for subscribing notifications of system information changes.
    -

    Code example:

     // To get total amount of system memory
    - console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
    - 
    +

    Code example:

    +/* To get total amount of system memory */
    +console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
    +
    @@ -726,12 +728,14 @@ The function must synchronously acquire the capabilities of the device.
    -

    Code example:

     var deviceCapabilities;
    - deviceCapabilities = tizen.systeminfo.getCapabilities();
    - if (deviceCapabilities.bluetooth) {
    -     console.log("Bluetooth is supported");
    - }
    - 
    +

    Code example:

    +var deviceCapabilities;
    +deviceCapabilities = tizen.systeminfo.getCapabilities();
    +if (deviceCapabilities.bluetooth)
    +{
    +   console.log("Bluetooth is supported");
    +}
    +
    @@ -774,14 +778,18 @@ The additional keys for the custom device capability are specified by OEM's and
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -823,13 +831,17 @@ That is the length of array retrieved by the getPropertyValueArray() method for
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -903,36 +915,45 @@ NotSupportedError - If the given property is not supported. (since Ti
    -

    Code example:

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

    Code example:

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

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -1002,26 +1023,35 @@ NotSupportedError - If the given property is not supported.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1120,12 +1150,14 @@ NotSupportedError - If the given property is not supported. (since Ti
    -

    Code example:

     function onSuccessCallback(cpu) {
    -     console.log("The cpu load : " + cpu.load);
    - }
    -
    - tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold : 0.2});
    - 
    +

    Code example:

    +function onSuccessCallback(cpu)
    +{
    +   console.log("The cpu load: " + cpu.load);
    +}
    +
    +tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2});
    +
    @@ -1253,16 +1285,20 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3839,15 +3875,15 @@ If the source is "HDMI 2", the number is 2.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -3958,19 +3994,22 @@ If the specified brightness value is not supported by the device, the brightness
  • -

    Code example:

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

    Code example:

    +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);
    +});
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/time.html b/org.tizen.web.apireference/html/device_api/tv/tizen/time.html index e1b30cc..2a00539 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/time.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/time.html @@ -286,9 +286,10 @@ Get timezones using getLocalTimezone() and getAvailableTimezones(). <
    -

    Code example:

     var current_dt = tizen.time.getCurrentDateTime();
    - console.log("current date/time is " + current_dt.toLocaleString());
    - 
    +

    Code example:

    +var current_dt = tizen.time.getCurrentDateTime();
    +console.log("current date/time is " + current_dt.toLocaleString());
    +
    @@ -316,8 +317,9 @@ Get timezones using getLocalTimezone() and getAvailableTimezones(). <
    -

    Code example:

     console.log("The local time zone is " + tizen.time.getLocalTimezone());
    - 
    +

    Code example:

    +console.log("The local time zone is " + tizen.time.getLocalTimezone());
    +
    @@ -352,9 +354,10 @@ with the most general descriptor first and the most specific one last. For examp
    -

    Code example:

     var tzids = tizen.time.getAvailableTimezones();
    - console.log("The device supports " + tzids.length + " time zones.");
    - 
    +

    Code example:

    +var tzids = tizen.time.getAvailableTimezones();
    +console.log("The device supports " + tzids.length + " time zones.");
    +
    @@ -499,12 +502,14 @@ parameters contain an invalid value.
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -546,19 +551,22 @@ Listener set with setTimezoneChangeListener() method is called when dev
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -582,19 +590,23 @@ Listener set with setTimezoneChangeListener() method is called when dev
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -638,19 +650,23 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -674,18 +690,23 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1882,9 +1903,10 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var now = tizen.time.getCurrentDateTime();
    - var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
    - 
    +

    Code example:

    +var now = tizen.time.getCurrentDateTime();
    +var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
    +
    @@ -2060,11 +2082,12 @@ savings if it is in the timezone. For example, if time zone is GMT+8, it will re
    -

    Code example:

     var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
    - var myDate = new Date();
    - var exp_offset = myDate.getTimezoneOffset()*60;
    - //offset is equals to exp_offset.
    - 
    +

    Code example:

    +var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
    +var myDate = new Date();
    +var exp_offset = myDate.getTimezoneOffset() * 60;
    +/* offset is equal to exp_offset */
    +
    @@ -2176,9 +2199,10 @@ identified by the TZDate object. 1.0

    -

    Code example:

     var now = tizen.time.getCurrentDateTime();
    - var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); // Becomes tomorrow, same time.
    - 
    +

    Code example:

    +var now = tizen.time.getCurrentDateTime();
    +var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); /* Becomes tomorrow, same time */
    +

    Constructors

    @@ -2270,16 +2294,17 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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.");
    - 
    +

    Code example:

    +/* 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.");
    +
    @@ -2328,10 +2353,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    @@ -2377,10 +2403,11 @@ This method takes the units into consideration when doing the comparison.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    @@ -2427,10 +2454,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/tizen.html b/org.tizen.web.apireference/html/device_api/tv/tizen/tizen.html index ce0facc..a3993a8 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/tizen.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/tizen.html @@ -297,21 +297,24 @@ the specified value.

    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree".
    - var count = 100;
    - var offset = 0;
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    +

    Code example:

    +/* 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);
    - 
    +tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset); +
    @@ -400,25 +403,30 @@ Range filters, where only one boundary is set, are available.

    -

    Code example:

     var count = 100;
    - var offset = 0;
    - // Use the modifiedDate attribute with a range that starts today and ends in 1 day
    - // (meaning that you search for all contents modified today)
    - var today = new Date();
    - var today_begin = new Date(today.getFullYear(), today.getMonth(),today.getDate());
    - var today_end = new Date(today.getFullYear(), today.getMonth(),today.getDate()+1);
    - var dateRangeFilter = new tizen.AttributeRangeFilter("modifiedDate", today_begin, today_end);
    +

    Code example:

    +var count = 100;
    +var offset = 0;
    +/*
    +   Use the modifiedDate attribute with a range that starts today and ends in 1 day
    +   (meaning that you search for all contents modified today)
    +*/
    +var today = new Date();
    +var today_begin = new Date(today.getFullYear(), today.getMonth(), today.getDate());
    +var today_end = new Date(today.getFullYear(), today.getMonth(), today.getDate()+1);
    +var dateRangeFilter = new tizen.AttributeRangeFilter("modifiedDate", today_begin, today_end);
     
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +function 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);
    - 
    +tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset); +
    @@ -506,23 +514,26 @@ The intersection - used to filter objects that match all the filters it includes
    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2".
    - var count = 100;
    - var offset = 0;
    - var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "U2");
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    - var filter = new tizen.CompositeFilter("INTERSECTION", [albumFilter, artistFilter]);
    +

    Code example:

    +/* 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);
    - 
    +tizen.content.find(findCB, errorCB, null, filter, null, count, offset); +
    @@ -575,34 +586,40 @@ Note that the sorting result of list type attributes is not determined.

    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the track number.
    - var count = 100;
    - var offset = 0;
    - var sortMode = new tizen.SortMode("trackNumber", "ASC");
    - var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "U2");
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    - var filter = new tizen.CompositeFilter("INTERSECTION", [albumFilter, artistFilter]);
    +

    Code example:

    +/* 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);
    - 
    +tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset); +

    Constructors

    @@ -1163,11 +1180,13 @@ In case of successful execution of an asynchronous call, SuccessCallback
    -

    Code example:

         function onSuccess() {
    -         console.log("Application launched successfully");
    -     }
    -     tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
    - 
    +

    Code example:

    +function onSuccess()
    +{
    +   console.log("Application launched successfully");
    +}
    +tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
    +

    Methods

    @@ -1210,16 +1229,20 @@ it silently fails and there is no further action.

    -

    Code example:

      // Define the error callback.
    -  function onerror(error) {
    -    console.log(error.message);
    -  }
    -  function onsuccess() {
    -      console.log("The application has launched successfully");
    -  }
    +

    Code example:

    +/* Define the error callback */
    +function onerror(error)
    +{
    +   console.log(error.message);
    +}
     
    -  tizen.application.launch("targetApp0.main", onsuccess, onerror);
    - 
    +function onsuccess() +{ +   console.log("The application has launched successfully"); +} + +tizen.application.launch("targetApp0.main", onsuccess, onerror); +

    Methods

    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/tvaudiocontrol.html b/org.tizen.web.apireference/html/device_api/tv/tizen/tvaudiocontrol.html index 92573f4..686a72b 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/tvaudiocontrol.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/tvaudiocontrol.html @@ -279,14 +279,16 @@ are used, then mute is disabled.
    -

    Code example:

     // Turn on the silent mode
    - tizen.tvaudiocontrol.setMute(true);
    - 
    +

    Code example:

    +/* Turn on the silent mode */
    +tizen.tvaudiocontrol.setMute(true);
    +
    -

    Code example:

     // Turn off the silent mode
    - tizen.tvaudiocontrol.setMute(false);
    - 
    +

    Code example:

    +/* Turn off the silent mode */
    +tizen.tvaudiocontrol.setMute(false);
    +
    @@ -327,33 +329,41 @@ are used, then mute is disabled.
    -

    Code example:

     // 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!");
    - }
    - 
    +

    Code example:

    +/* 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!");
    +}
    +
    -

    Code example:

     // 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.");
    - }
    - 
    +

    Code example:

    +/* 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.");
    +}
    +
    @@ -407,17 +417,22 @@ The value of volume is allowed from 0 to 100. If an invalid value is pa
    -

    Code example:

     // 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.");
    -     }
    - }
    - 
    +

    Code example:

    +/* 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.");
    +   }
    +}
    +
    @@ -457,21 +472,24 @@ then execution of this functions will disable it.
    -

    Code example:

     // 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.");
    -  }
    - 
    +

    Code example:

    +/* 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.");
    +}
    +
    @@ -515,21 +533,24 @@ then execution of this functions will disable it.
    -

    Code example:

     // 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.");
    -  }
    - 
    +

    Code example:

    +/* 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.");
    +}
    +
    @@ -621,22 +642,27 @@ Note that this method overwrites the previously registered listener.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -673,19 +699,21 @@ Note that this method overwrites the previously registered listener.
    -

    Code example:

     var expectedVolumeLevel = 50;
    +

    Code example:

    +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);
    - 
    +tizen.tvaudiocontrol.setVolume(expectedVolumeLevel); +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/tvchannel.html b/org.tizen.web.apireference/html/device_api/tv/tizen/tvchannel.html index a2afd66..a54965e 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/tvchannel.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/tvchannel.html @@ -396,39 +396,53 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -503,21 +517,28 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -592,22 +613,29 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -677,24 +705,30 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -785,46 +819,58 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -877,14 +923,18 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -962,24 +1012,30 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1037,13 +1093,17 @@ If there is no TV program data grabbed from broadcaster, it will return nul
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1103,16 +1163,22 @@ If there is no TV program data grabbed from broadcaster, it will return nul
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1214,16 +1280,21 @@ If there is no TV program data grabbed from broadcaster, it will return nul
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1312,15 +1383,20 @@ The returned array will contain at least one FavoriteLis
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1369,9 +1445,10 @@ The returned array will contain at least one FavoriteLis
    -

    Code example:

     var res = tizen.tvchannel.getBroadcastStandard();
    - console.log("Video standard: " + res);
    - 
    +

    Code example:

    +var res = tizen.tvchannel.getBroadcastStandard();
    +console.log("Video standard: " + res);
    +
    @@ -2110,18 +2187,24 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2190,18 +2273,24 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2276,26 +2365,32 @@ The ErrorCallback will be launched in the following situations:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/tvdisplaycontrol.html b/org.tizen.web.apireference/html/device_api/tv/tizen/tvdisplaycontrol.html index 2871a07..b573351 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/tvdisplaycontrol.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/tvdisplaycontrol.html @@ -275,13 +275,17 @@ For example, Display Control API provides whether your device supports 3D.
    -

    Code example:

     try {
    -      var current3Dmode = tizen.tvdisplaycontrol.get3DEffectMode()
    -      console.log("The current 3D mode is " + current3Dmode + ".");
    - } catch (error) {
    -     console.log(error.name);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var current3Dmode = tizen.tvdisplaycontrol.get3DEffectMode()
    +   console.log("The current 3D mode is " + current3Dmode + ".");
    +}
    +catch (error)
    +{
    +   console.log(error.name);
    +}
    +
    @@ -325,18 +329,27 @@ For example, Display Control API provides whether your device supports 3D.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -389,22 +402,30 @@ For example, Display Control API provides whether your device supports 3D.
    -

    Code example:

     function successCB(effects) {
    -     for( var i = 0; i < effects.length; ++i ) {
    -         console.log(effects[i] +" : this mode is supported on a device.");
    -     }
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   tizen.tvdisplaycontrol.getSupported3DEffectModeList(successCB, errorCB); +} +catch (error) +{ +   console.log(error.name); +} +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/tvinfo.html b/org.tizen.web.apireference/html/device_api/tv/tizen/tvinfo.html index 167f1c0..b9a0ebd 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/tvinfo.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/tvinfo.html @@ -419,8 +419,9 @@ There is a tizen.tvinfo object that allows accessing the functionality of the TV
    -

    Code example:

     console.log("Caption menu turned on: " + (tizen.tvinfo.getCaptionValue("CAPTION_ONOFF_KEY") === "CAPTION_ON"));
    - 
    +

    Code example:

    +console.log("Caption menu turned on: " + (tizen.tvinfo.getCaptionValue("CAPTION_ONOFF_KEY") === "CAPTION_ON"));
    +
    @@ -469,10 +470,12 @@ There is a tizen.tvinfo object that allows accessing the functionality of the TV
    -

    Code example:

     var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function(value) {
    -     console.log("Caption menu state changed: " + value);
    - });
    - 
    +

    Code example:

    +var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function(value)
    +{
    +   console.log("Caption menu state changed: " + value);
    +});
    +
    @@ -505,9 +508,10 @@ There is a tizen.tvinfo object that allows accessing the functionality of the TV
    -

    Code example:

     var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function() {});
    - tizen.tvinfo.removeCaptionValueChangeListener(id);
    - 
    +

    Code example:

    +var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function() {});
    +tizen.tvinfo.removeCaptionValueChangeListener(id);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/tvinputdevice.html b/org.tizen.web.apireference/html/device_api/tv/tizen/tvinputdevice.html index 70e464b..32a159e 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/tvinputdevice.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/tvinputdevice.html @@ -249,22 +249,26 @@ Mandatory keys will not be retrieved by this method.
    -

    Code example:

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

    Code example:

    +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");
    +   }
    +});
    +
    @@ -371,15 +375,20 @@ An application cannot register the mandatory keys (ArrowLeft, ArrowRight, ArrowU
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +}
    +
    @@ -428,8 +437,9 @@ An application cannot register the mandatory keys (ArrowLeft, ArrowRight, ArrowU
    -

    Code example:

     tizen.tvinputdevice.unregisterKey("VolumeDown");
    - 
    +

    Code example:

    +tizen.tvinputdevice.unregisterKey("VolumeDown");
    +
    @@ -506,17 +516,20 @@ UnknownError: In case of any other error.
    -

    Code example:

     function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +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);
    - 
    +var keys = ["VolumeUp", "VolumeDown"]; +tizen.tvinputdevice.registerKeyBatch(keys, successCB, errorCB); +
    @@ -587,16 +600,20 @@ UnknownError: In case of any other error.
    -

    Code example:

     function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +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);
    - 
    +var keys = ["VolumeUp", "VolumeDown"]; +tizen.tvinputdevice.unregisterKeyBatch(keys, successCB, errorCB); +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/tvwindow.html b/org.tizen.web.apireference/html/device_api/tv/tizen/tvwindow.html index f71a9e8..f528280 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/tvwindow.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/tvwindow.html @@ -339,18 +339,24 @@ functionality of the TV Window API.
    -

    Code example:

     function successCB(availableWindows) {
    -    for (var i = 0; i < availableWindows.length; i++) {
    -        console.log("Window ["+ i + "] = " + availableWindows[i]);
    -    }
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   tizen.tvwindow.getAvailableWindows(successCB); +} +catch (error) +{ +   console.log("Error name = " + error.name + ", Error message = " + error.message); +} +
    @@ -410,39 +416,49 @@ functionality of the TV Window API.
    -

    Code example:

     var connectedVideoSources;
    - function successCB(source, type) {
    -     console.log("setSource() is successfully done. source name = " + source.name + ", source port number = " + source.number);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   tizen.systeminfo.getPropertyValue("VIDEOSOURCE", systemInfoSuccessCB, systemInfoErrorCB); +} +catch (error) +{ +   console.log("Error name = " + error.name + ", Error message = " + error.message); +} +
    @@ -494,14 +510,18 @@ functionality of the TV Window API.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -598,44 +618,59 @@ The errorCallback is invoked with these error types:
    -

    Code example:

     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] + "]");
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   tizen.tvwindow.show(successCB, null, ["0", "0px", "50%", "540px"], "MAIN"); +} +catch (error) +{ +   console.log("error: " + error.name); +} +
    -

    Code example:

     function successCB(windowRect, type) {
    -     // expected result : ["0", "0", "50%", "50%"]
    -     console.log("Rectangle : [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"], "MAIN"); +} +catch (error) +{ +   console.log("error: " + error.name); +} +
    -

    Code example:

     function successCB(windowRect, type) {
    -     // expected result : ["10.5%", "10%", "900", "500px"]
    -     console.log("Rectangle : [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   tizen.tvwindow.show(successCB, null, ["10.5%", "10%", "900", "500px"]); +} +catch (error) +{ +   console.log("error: " + error.name); +} +
    @@ -761,25 +796,31 @@ If you omit unit, the pixel("px") unit will be used as a defau
    -

    Code example:

     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] + "]");
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"]); +} +catch (error) +{ +   console.log("error: " + error.name); +} +
    @@ -831,13 +872,15 @@ If you omit unit, the pixel("px") unit will be used as a defau
    -

    Code example:

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

    Code example:

    +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");
    +}
    +
    @@ -893,20 +936,26 @@ If you omit unit, the pixel("px") unit will be used as a defau
    -

    Code example:

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

    Code example:

    +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);
    - }
    - 
    +try +{ +   var watch = tizen.tvwindow.addVideoResolutionChangeListener(change); +} +catch (error) +{ +   console.log("Error name = " + error.name + ", Error message = " + error.message); +} +
    diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/websetting.html b/org.tizen.web.apireference/html/device_api/tv/tizen/websetting.html index ea47d19..d419426 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/websetting.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/websetting.html @@ -157,12 +157,14 @@ InvalidValuesError - If any of the input parameters contain an invalid value.
    -

    Code example:

     function successCallback() {
    -     console.log("The requested user agent string has just been set successfully.");
    - }
    +

    Code example:

    +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);
    - 
    +tizen.websetting.setUserAgentString("the new user agent string to set", successCallback); +
    @@ -214,12 +216,14 @@ UnknownError - If any error occurs while deleting the cookies.
    -

    Code example:

     function successCallback() {
    -     console.log("The cookies saved for your application have just been removed.");
    - }
    +

    Code example:

    +function successCallback()
    +{
    +   console.log("The cookies saved for your application have just been removed.");
    +}
     
    - tizen.websetting.removeAllCookies(successCallback);
    - 
    +tizen.websetting.removeAllCookies(successCallback); +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/alarm.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/alarm.html index 098e345..f5b9d10 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/alarm.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/alarm.html @@ -278,12 +278,13 @@ For more information about the application control, see
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -340,18 +341,23 @@ If an alarm goes off, it will be removed from the storage automatically.
    -

    Code example:

     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.");
    -   }
    - }
    - 
    +

    Code example:

    +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.");
    +   }
    +}
    +
    @@ -393,9 +399,10 @@ Because each application has its own alarm storage, this method removes alarms o
    -

    Code example:

     tizen.alarm.removeAll();
    - console.log("remove all registered alarms in the storage.");
    - 
    +

    Code example:

    +tizen.alarm.removeAll();
    +console.log("remove all registered alarms in the storage.");
    +
    @@ -440,18 +447,19 @@ Because each application has its own alarm storage, this method removes alarms o
    -

    Code example:

     // Sets an alarm
    - var date = new Date();
    - date.setHours(date.getHours()+1);
    - var abs_alarm = new tizen.AlarmAbsolute(date);
    +

    Code example:

    +/* 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());
    - 
    +/* Gets an alarm */ +var alarm = tizen.alarm.get(abs_alarm.id); +console.log("The alarm will trigger at " + alarm.getNextScheduledDate()); +
    @@ -484,9 +492,10 @@ Alarms that have already been triggered are removed automatically from the stora
    -

    Code example:

     var alarms = tizen.alarm.getAll();
    - console.log(alarms.length + " alarms present in the storage.");
    - 
    +

    Code example:

    +var alarms = tizen.alarm.getAll();
    +console.log(alarms.length + " alarms present in the storage.");
    +
    @@ -548,17 +557,18 @@ It is guaranteed that this alarm will be fired after at least delay sec If period is provided, it will be adjusted by the operating system, however this value will not be lower than 600 seconds.

    -

    Code example:

     // Gets the current application ID.
    - var appId = tizen.application.getCurrentApplication().appInfo.id;
    +

    Code example:

    +/* 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);
    - 
    +/* 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); +
    @@ -630,16 +640,17 @@ If the alarm has expired, this method returns null.
    -

    Code example:

     // Gets the current application ID.
    - var appId = tizen.application.getCurrentApplication().appInfo.id;
    +

    Code example:

    +/* 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);
    - 
    +var sec = alarm.getRemainingSeconds(); +console.log("remaining time is " + sec); +
    @@ -674,22 +685,23 @@ If a period is provided, the alarm keeps triggering for the given inter

    -

    Code example:

     // Gets the current application ID.
    - var appId = tizen.application.getCurrentApplication().appInfo.id;
    +

    Code example:

    +/* 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);
    - 
    +/* 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); +
    @@ -786,17 +798,18 @@ If the alarm has expired, this method returns null. The returned date
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/application.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/application.html index d3be44c..2bcbace 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/application.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/application.html @@ -391,9 +391,10 @@ The tizen.application object allows access to the Application API's fun
    -

    Code example:

     var app = tizen.application.getCurrentApplication();
    - console.log("Current application's app id is " + app.appInfo.id);
    - 
    +

    Code example:

    +var app = tizen.application.getCurrentApplication();
    +console.log("Current application's app id is " + app.appInfo.id);
    +
    @@ -461,23 +462,28 @@ UnknownError - If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -542,13 +548,15 @@ UnknownError - If any other error occurs.
    -

    Code example:

     function onsuccess() {
    -     console.log("The application has launched successfully");
    - }
    +

    Code example:

    +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);
    - 
    +/* Let's assume that application "targetApp0.main" has been installed */ +tizen.application.launch("targetApp0.main", onsuccess); +
    @@ -642,34 +650,33 @@ UnknownError: If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -724,42 +731,41 @@ UnknownError - If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -806,13 +812,15 @@ UnknownError - If an unknown error occurs.
    -

    Code example:

     function onRunningAppsContext(contexts) {
    -     for (var i = 0; i < contexts.length; i++)
    -         console.log("ID : " + contexts[i].id);
    - }
    +

    Code example:

    +function onRunningAppsContext(contexts)
    +{
    +   for (var i = 0; i < contexts.length; i++)
    +      console.log("ID: " + contexts[i].id);
    +}
     
    - tizen.application.getAppsContext(onRunningAppsContext);
    - 
    +tizen.application.getAppsContext(onRunningAppsContext); +
    @@ -856,9 +864,10 @@ The list of running applications and their application IDs is obtained with
    -

    Code example:

     var appContext = tizen.application.getAppContext(null);
    - console.log("Application context retrieved for app " + appContext.appId);
    - 
    +

    Code example:

    +var appContext = tizen.application.getAppContext(null);
    +console.log("Application context retrieved for app " + appContext.appId);
    +
    @@ -905,13 +914,15 @@ UnknownError - If an unknown error occurs.
    -

    Code example:

     function onListInstalledApps(applications) {
    -     for (var i = 0; i < applications.length; i++)
    -         console.log("ID : " + applications[i].id);
    - }
    +

    Code example:

    +function onListInstalledApps(applications)
    +{
    +   for (var i = 0; i < applications.length; i++)
    +      console.log("ID: " + applications[i].id);
    +}
     
    - tizen.application.getAppsInfo(onListInstalledApps);
    - 
    +tizen.application.getAppsInfo(onListInstalledApps); +
    @@ -959,9 +970,10 @@ The list of installed applications and their application IDs is obtained with
    -

    Code example:

     var appInfo = tizen.application.getAppInfo(null);
    - console.log("Current application name : " + appInfo.name);
    - 
    +

    Code example:

    +var appInfo = tizen.application.getAppInfo(null);
    +console.log("Current application name: " + appInfo.name);
    +
    @@ -1042,13 +1054,15 @@ The certificate types are listed below:
    -

    Code example:

     var appCerts = tizen.application.getAppCerts(null);
    +

    Code example:

    +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);
    - }
    - 
    +for (var i = 0; i < appCerts.length; i++) +{ +   console.log("#" + i + " type:" + appCerts[i].type); +   console.log("#" + i + " value:" + appCerts[i].value); +} +
    @@ -1096,9 +1110,10 @@ If the ID is set to null or not set at all, it returns the shared dir
    -

    Code example:

     var sharedDir = tizen.application.getAppSharedURI(null);
    - console.log("shared directory : " + sharedDir);
    - 
    +

    Code example:

    +var sharedDir = tizen.application.getAppSharedURI(null);
    +console.log("shared directory: " + sharedDir);
    +
    @@ -1157,10 +1172,10 @@ an empty array is returned
    -

    Code example:

     var metaDataArray = tizen.application.getAppMetaData(null);
    - console.log("size of metadata : " + metaDataArray.length);
    -
    - 
    +

    Code example:

    +var metaDataArray = tizen.application.getAppMetaData(null);
    +console.log("size of metadata: " + metaDataArray.length);
    +
    @@ -1226,19 +1241,24 @@ with the corresponding listener identifier.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1280,20 +1300,25 @@ applications on a device.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1378,10 +1403,11 @@ the basic operations (such as exit or hide) for the current application.
    -

    Code example:

     var app = tizen.application.getCurrentApplication();
    +

    Code example:

    +var app = tizen.application.getCurrentApplication();
     
    - app.exit();
    - 
    +app.exit(); +
    @@ -1405,10 +1431,11 @@ the basic operations (such as exit or hide) for the current application.
    -

    Code example:

     var app = tizen.application.getCurrentApplication();
    +

    Code example:

    +var app = tizen.application.getCurrentApplication();
     
    - app.hide();
    - 
    +app.hide(); +
    @@ -1448,12 +1475,14 @@ appropriately when it is launched.
    -

    Code example:

     var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
    +

    Code example:

    +var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
     
    - if (reqAppControl) {
    -     console.log("Requester AppID : " + reqAppControl.callerAppId);
    - }
    - 
    +if (reqAppControl) +{ +   console.log("Requester AppID: " + reqAppControl.callerAppId); +} +
    @@ -1504,28 +1533,35 @@ System events do not require an application identifier to be specified. Therefor
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1558,31 +1594,39 @@ System events do not require an application identifier to be specified. Therefor
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1600,7 +1644,7 @@ System events do not require an application identifier to be specified. Therefor

    @@ -1629,14 +1673,16 @@ An application can listen to events from other applications. However, it can onl
    -

    Code example:

     var myCustomData = {
    -   foo: 'bar'
    - };
    +

    Code example:

    +var myCustomData = 
    +{
    +   foo: 'bar'
    +};
     
    - var app = tizen.application.getCurrentApplication();
    +var app = tizen.application.getCurrentApplication();
     
    - app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
    - 
    +app.broadcastEvent({"name": "custom_user_event"}, myCustomData); +
    @@ -1654,7 +1700,7 @@ An application can listen to events from other applications. However, it can onl

    -An application can listen to events from other applications. However, it can only broadcast it's own events. Therefore, the appId attribute of the EventInfo 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 appId attribute of the EventInfo dictionary must be the identifier of the application which calls this method.

    @@ -1683,14 +1729,16 @@ An application can listen to events from other applications. However, it can onl
    -

    Code example:

     var myTrustedCustomData = {
    -   foo: 'bar'
    - };
    +

    Code example:

    +var myTrustedCustomData = 
    +{
    +   foo: 'bar'
    +};
     
    - var app = tizen.application.getCurrentApplication();
    +var app = tizen.application.getCurrentApplication();
     
    - app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
    - 
    +app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData); +
    @@ -1898,8 +1946,9 @@ between applications through the ApplicationControl interface. 2.0

    -

    Code example:

     var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
    - 
    +

    Code example:

    +var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
    +

    Constructors

    @@ -1962,15 +2011,11 @@ and launches the selected application. 2.0

    -

    Code example:

     var appControl =
    -       new tizen.ApplicationControl(
    -                  "http://tizen.org/appcontrol/operation/view",
    -                  null,
    -                  "image/jpeg",
    -                  null,
    -                  [new tizen.ApplicationControlData("images",
    -                                                    [imagedata1, imagedata2])] );
    - 
    +

    Code example:

    +var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
    +                                              null, "image/jpeg", null,
    +                                              [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
    +

    Constructors

    @@ -2128,17 +2173,20 @@ It contains the information that the calling application passed to launchApp
    -

    Code example:

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

    Code example:

    +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]);
    +   }
    +}
    +
    @@ -2168,16 +2216,19 @@ to perform the requested action.
    -

    Code example:

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

    Code example:

    +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();
    +   }
    +}
    +
    @@ -2309,13 +2360,15 @@ This callback interface specifies a success method with an array of
    -

    Code example:

     function onListInstalledApps(applications) {
    -     for (var i = 0; i < applications.length; i++)
    -         console.log("ID : " + applications[i].id);
    - }
    +

    Code example:

    +function onListInstalledApps(applications)
    +{
    +   for (var i = 0; i < applications.length; i++)
    +      console.log("ID: " + applications[i].id);
    +}
     
    - tizen.application.getAppsInfo(onListInstalledApps);
    - 
    +tizen.application.getAppsInfo(onListInstalledApps); +
    @@ -2369,43 +2422,42 @@ It is used in ApplicationManager.findAppControl().
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2484,35 +2536,34 @@ This callback interface specifies two methods:
    -

    Code example:

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

    Code example:

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

    Methods

    @@ -2581,19 +2632,24 @@ an application is installed, updated, or uninstalled.

    -

    Code example:

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

    Code example:

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

    Methods

    @@ -2731,30 +2787,37 @@ Platform modules will be able to broadcast system events in a future Tizen relea
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2789,7 +2852,7 @@ System events do not require an application identifier to be specified. If one i

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

    System events do not require an application identifier to be specified. If one is specified, the event will be interpreted as an user event. diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/archive.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/archive.html index 9fceb3b..12dc1d7 100755 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/archive.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/archive.html @@ -457,16 +457,19 @@ In this mode, getEntries(), getEntryByName(), and extractA

    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -499,13 +502,15 @@ In this mode, getEntries(), getEntryByName(), and extractA
    -

    Code example:

     function openSuccess(archive) {
    -     operationId = archive.extractAll("downloads/extracted");
    -     tizen.archive.abort(operationId);
    - }
    -
    - tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
    - 
    +

    Code example:

    +function openSuccess(archive)
    +{
    +   operationId = archive.extractAll("downloads/extracted");
    +   tizen.archive.abort(operationId);
    +}
    +
    +tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
    +
    @@ -724,24 +729,29 @@ If the source file is big then the callback can also be called while the file is
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -835,24 +845,29 @@ UnknownError: In any other error case
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -921,23 +936,28 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1012,20 +1032,24 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1229,24 +1253,29 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/badge.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/badge.html index edb896d..7b3cece 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/badge.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/badge.html @@ -169,12 +169,16 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
    -

    Code example:

     try {
    -     tizen.badge.setBadgeCount("AVbg1ZHu6l.BadgeSample", 3);
    - } catch(e) {
    -     console.log("Error Exception, error name : " + e.name + ", error message : " + e.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.badge.setBadgeCount("AVbg1ZHu6l.BadgeSample", 3);
    +}
    +catch (e)
    +{
    +   console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
    +}
    +
    @@ -227,12 +231,16 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
    -

    Code example:

     try {
    -     var count = tizen.badge.getBadgeCount("AVbg1ZHu6l.BadgeSample");
    - } catch(e) {
    -     console.log("Error Exception, error name : " + e.name + ", error message : " + e.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var count = tizen.badge.getBadgeCount("AVbg1ZHu6l.BadgeSample");
    +}
    +catch (e)
    +{
    +   console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
    +}
    +
    @@ -288,13 +296,15 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
    -

    Code example:

      function watcher(appId, count) {
    -      console.log(appId + ' badge number were updated : ' + count);
    -  }
    +

    Code example:

    +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); +
    @@ -343,17 +353,19 @@ There is a tizen.badge object that allows accessing the functionality of the Bad
    -

    Code example:

      // Receives badge number changes
    -  function watcher(appId, count) {
    -      console.log(appId + ' badge number were updated : ' + count);
    -  }
    +

    Code example:

    +/* 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"]);
    - 
    +/* Cancels the watch operation */ +tizen.badge.removeChangeListener(["AVbg1ZHu6l.BadgeSample", "BDb5tZJe47.TestSample"]); +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/bluetooth.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/bluetooth.html index 89072bb..8aad102 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/bluetooth.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/bluetooth.html @@ -546,9 +546,10 @@ The tizen.bluetooth object allows access to the Bluetooth API.
    BluetoothLEServiceData(DOMString uuid, DOMString data);
    -

    Code example:

     // Creates a serviceData.
    - var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    - 
    +

    Code example:

    +/* Creates a serviceData */
    +var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    +
    @@ -564,10 +565,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. 2.3.1

    -

    Code example:

     // Creates a serviceData.
    - var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    - service.uuid = "f236-41a4";
    - 
    +

    Code example:

    +/* Creates a serviceData */
    +var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    +service.uuid = "f236-41a4";
    +
  • @@ -579,10 +581,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. 2.3.1

    -

    Code example:

     // Creates a serviceData.
    - var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    - service.data = "0x1815";
    - 
    +

    Code example:

    +/* Creates a serviceData */
    +var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    +service.data = "0x1815";
    +
  • @@ -607,9 +610,10 @@ The tizen.bluetooth object allows access to the Bluetooth API.
    BluetoothLEManufacturerData(DOMString id, DOMString data);
    -

    Code example:

     // Creates a manufacturerData.
    - var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    - 
    +

    Code example:

    +/* Creates a manufacturerData */
    +var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    +
    @@ -625,10 +629,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. 2.3.1

    -

    Code example:

     // Creates a manufacturerData.
    - var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    - manufacturer.id = "129";
    - 
    +

    Code example:

    +/* Creates a manufacturerData */
    +var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    +manufacturer.id = "129";
    +
  • @@ -640,10 +645,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. 2.3.1

    -

    Code example:

     // Creates a manufacturerData.
    - var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    - manufacturer.data = "0x0059"
    - 
    +

    Code example:

    +/* Creates a manufacturerData */
    +var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    +manufacturer.data = "0x0059"
    +
  • @@ -673,9 +679,13 @@ This dictionary is used as an input parameter of the BluetoothLEAdvertiseData co

    -

    Code example:

     var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    -                    appearance: 192, includeTxPowerLevel: false  }
    - 
    +

    Code example:

    +var advertData = 
    +{
    +   includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    +   appearance: 192, includeTxPowerLevel: false
    +}
    +
    @@ -704,10 +714,14 @@ This represents the data to be advertised as well as the scan response data for

    -

    Code example:

     var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    -                    appearance: 192, includeTxPowerLevel: false }
    - var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
    - 
    +

    Code example:

    +var advertData =
    +{
    +   includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    +   appearance: 192, includeTxPowerLevel: false
    +}
    +var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
    +

    Constructors

    @@ -726,9 +740,10 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - advertise.includeName = true;
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +advertise.includeName = true;
    +
  • @@ -741,9 +756,10 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - advertise.uuids = ["180d"];
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +advertise.uuids = ["180d"];
    +
  • @@ -756,9 +772,10 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - advertise.solicitationuuids = ["180f"];
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +advertise.solicitationuuids = ["180f"];
    +
  • @@ -775,9 +792,10 @@ See the -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - advertise.appearance = 192;
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +advertise.appearance = 192;
    +
  • @@ -790,9 +808,10 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - advertise.includeTxPowerLevel = true;
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +advertise.includeTxPowerLevel = true;
    +
  • @@ -804,10 +823,11 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    - advertise.serviceData = service;
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    +advertise.serviceData = service;
    +
  • @@ -819,10 +839,11 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    - var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    - advertise.manufacturerData = manufacture;
    - 
    +

    Code example:

    +var advertise = new tizen.BluetoothLEAdvertiseData();
    +var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    +advertise.manufacturerData = manufacture;
    +
  • @@ -858,8 +879,9 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     console.log(tizen.bluetooth.deviceMajor);
    - 
    +

    Code example:

    +console.log(tizen.bluetooth.deviceMajor);
    +
  • @@ -872,8 +894,9 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     console.log(tizen.bluetooth.deviceMinor);
    - 
    +

    Code example:

    +console.log(tizen.bluetooth.deviceMinor);
    +
  • @@ -886,8 +909,9 @@ If attribute is set to null, The default value is set to a false. 2.3.1

    -

    Code example:

     console.log(tizen.bluetooth.deviceService);
    - 
    +

    Code example:

    +console.log(tizen.bluetooth.deviceService);
    +
  • @@ -937,12 +961,16 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     try {
    -     var adapter = tizen.bluetooth.getDefaultAdapter() ;
    - } catch (err) {
    -     console.log (err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var adapter = tizen.bluetooth.getDefaultAdapter();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -993,12 +1021,16 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     try {
    -     var adapter = tizen.bluetooth.getLEAdapter();
    - } catch (err) {
    -     console.log(err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var adapter = tizen.bluetooth.getLEAdapter();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1089,10 +1121,11 @@ Registering a service in the device service database 2.3.1

    -

    Code example:

     // Access adapter name
    - var adapter = tizen.bluetooth.getDefaultAdapter();
    - console.log ("Bluetooth adapter name: " + adapter.name);
    - 
    +

    Code example:

    +/* Access adapter name */
    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +console.log("Bluetooth adapter name: " + adapter.name);
    +
  • @@ -1105,9 +1138,10 @@ Registering a service in the device service database
  • 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - console.log("Bluetooth device address: " + adapter.address);
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +console.log("Bluetooth device address: " + adapter.address);
    +
  • @@ -1131,9 +1165,10 @@ This attribute holds one of the following 2 values: 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));
    +
  • @@ -1146,10 +1181,11 @@ This attribute holds one of the following 2 values: 2.3.1

    -

    Code example:

     // Queries the current visible state
    - var adapter = tizen.bluetooth.getDefaultAdapter();
    - console.log ("Bluetooth Visibility: " + (adapter.visible ? "On" : "Off"));
    - 
    +

    Code example:

    +/* Queries the current visible state */
    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +console.log("Bluetooth Visibility: " + (adapter.visible ? "On" : "Off"));
    +
  • @@ -1232,25 +1268,30 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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");
    +}
    +
    @@ -1330,41 +1371,51 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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();
    +}
    +
    @@ -1405,21 +1456,26 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1448,24 +1504,29 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1546,41 +1607,50 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1648,56 +1718,67 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1774,27 +1855,32 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1870,20 +1956,23 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1957,19 +2046,22 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2043,25 +2135,30 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -2147,52 +2244,58 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +      });
    +   }
    +}
    +
    @@ -2239,16 +2342,20 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -2352,13 +2459,13 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("[Found device] address: " + device.address);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("[Found device] address: " + device.address);
    +});
    +
    @@ -2399,16 +2506,17 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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();
    +   }
    +});
    +
    @@ -2498,32 +2606,30 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2564,25 +2670,27 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +
    @@ -2603,20 +2711,21 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

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

    Code example:

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

    Attributes

    @@ -2631,10 +2740,10 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

     var service = device.getService(device.uuids[0]);
    - console.log("Service UUID " + service.uuid);
    -
    - 
    +

    Code example:

    +var service = device.getService(device.uuids[0]);
    +console.log("Service UUID " + service.uuid);
    +
  • @@ -2648,12 +2757,13 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

     var service = device.getService(device.uuids[0]);
    - for (var i = 0; i  service.services.length; ++i) {
    -     console.log("Subservices UUID " + service.services[i].uuid);
    - }
    -
    - 
    +

    Code example:

    +var service = device.getService(device.uuids[0]);
    +for (var i = 0; i  service.services.length; ++i)
    +{
    +   console.log("Subservices UUID " + service.services[i].uuid);
    +}
    +
  • @@ -2667,12 +2777,13 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

     var service = device.getService(device.uuids[0]);
    - for (var i = 0; i  service.characteristics.length; ++i) {
    -     console.log("Subservices UUID " + service.characteristics[i].isWritable);
    - }
    -
    - 
    +

    Code example:

    +var service = device.getService(device.uuids[0]);
    +for (var i = 0; i  service.characteristics.length; ++i)
    +{
    +   console.log("Subservices UUID " + service.characteristics[i].isWritable);
    +}
    +
  • @@ -2868,34 +2979,40 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -2965,37 +3082,44 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -3044,36 +3168,40 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -3186,35 +3314,41 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -3284,38 +3418,45 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -3565,11 +3706,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Device Name: " + device.name);
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Device Name: " + device.name);
    +});
    +
  • @@ -3582,11 +3725,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Device Address: " + device.address);
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Device Address: " + device.address);
    +});
    +
  • @@ -3599,11 +3744,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Device Major Class: " + device.deviceClass.major);
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Device Major Class: " + device.deviceClass.major);
    +});
    +
  • @@ -3616,11 +3763,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
    +});
    +
  • @@ -3633,11 +3782,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
    +});
    +
  • @@ -3650,11 +3801,13 @@ A BluetoothDevice object can be retrieved using one of the following AP 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
    - });
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getDefaultAdapter();
    +adapter.getDevice("11:22:33:44:55:66", function(device)
    +{
    +   console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
    +});
    +
  • @@ -3668,27 +3821,31 @@ A BluetoothDevice object can be retrieved using one of the following AP 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +      });
    +   }
    +});
    +
  • @@ -3767,57 +3924,68 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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); });
    +
    @@ -3878,13 +4046,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.address);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.address);
    +});
    +
  • @@ -3897,13 +4065,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.name);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.name);
    +});
    +
  • @@ -3916,13 +4084,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.txpowerlevel);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.txpowerlevel);
    +});
    +
  • @@ -3935,13 +4103,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.appearance);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.appearance);
    +});
    +
  • @@ -3955,18 +4123,19 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -3980,18 +4149,19 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -4005,18 +4175,19 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -4029,15 +4200,15 @@ A BluetoothLEDevice object can be retrieved by using one of the followi 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -4055,14 +4226,14 @@ The signal strength depends on distance (between the device and the beacon) and 3.0

    -

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan(
    -     function onsuccess(device) {
    -         console.log("Found device: " + device.name);
    -         console.log("RSSI: " + device.rssi);
    -     }
    - );
    - 
    +

    Code example:

    +var adapter = tizen.bluetooth.getLEAdapter();
    +adapter.startScan(function onsuccess(device)
    +{
    +   console.log("Found device: " + device.name);
    +   console.log("RSSI: " + device.rssi);
    +});
    +

    Output example:

     Found device: beacon
    @@ -4138,24 +4309,27 @@ Instead, use http://tizen.org/privilege/bluetooth.
     
  • -

    Code example:

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

    Code example:

    +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);
    +   }
    +});
    +
    @@ -4221,29 +4395,35 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4299,26 +4479,31 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4359,28 +4544,33 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +

    Output example:

     Connected to device
    @@ -4422,30 +4612,37 @@ Instead, use http://tizen.org/privilege/bluetooth.
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4471,32 +4668,39 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -4656,46 +4860,55 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);});
    +
    @@ -4745,43 +4958,50 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);});
    +
    @@ -4886,25 +5106,31 @@ The BluetoothClassDeviceMajor interface contains the list of known valu 2.3.1

    -

    Code example:

     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");
    -
    - 
    +

    Code example:

    +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");
    +
  • @@ -4993,15 +5219,19 @@ Instead, use http://tizen.org/privilege/bluetooth.
  • -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -5210,35 +5440,39 @@ By default, this attribute is set to null.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -5306,49 +5540,54 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +      });
    +   }
    +}
    +
    @@ -5379,16 +5618,20 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -5485,19 +5728,22 @@ For example, pulse oximeter is 4100 and blood pressure monitor is 4103.
    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
    +

    Code example:

    +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);
    - 
    +healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError); +
    @@ -5572,38 +5818,44 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -5678,24 +5930,28 @@ By default, this attribute is set to null.
    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
    +

    Code example:

    +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);
    - 
    +healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError); +
    @@ -5765,46 +6021,60 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +}
    +
    @@ -5881,22 +6151,26 @@ Instead, use http://tizen.org/privilege/bluetooth. 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -5946,23 +6220,27 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -6022,30 +6300,35 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -6098,32 +6381,39 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -6165,35 +6455,42 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/content.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/content.html index f2fa510..20057c1 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/content.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/content.html @@ -450,13 +450,15 @@ contain an invalid value.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -531,23 +533,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -598,21 +604,26 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // The following example retrieves content directories in the storage.
    +

    Code example:

    +/* 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);
    - 
    +function getDirectoriesCB(directories) +{ +   directories.forEach(printDirectory); +} + +tizen.content.getDirectories(getDirectoriesCB, errorCB); +
    @@ -699,35 +710,40 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -799,21 +815,24 @@ contain an invalid value (e.g. given contentURI is an empty string).
    -

    Code example:

     // The following example scan 'tizen.jpg' in media directory
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +/* 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');
    +}
     
    - 
    +tizen.filesystem.resolve("images/tizen.jpg", function(imageFile) +{ +   tizen.content.scanFile(imageFile.toURI(), successCB, errorCB); +}); +
    @@ -893,21 +912,24 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

     // The following example scans 'images' directory
    -
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +/* 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');
    +}
     
    - 
    +tizen.filesystem.resolve("images", function(directory) +{ +   tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB); +}); +
    @@ -962,9 +984,9 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

     tizen.content.cancelScanDirectory(directory.toURI());
    -
    - 
    +

    Code example:

    +tizen.content.cancelScanDirectory(directory.toURI());
    +
    @@ -1006,32 +1028,40 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
    -

    Code example:

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

    Code example:

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

    Output example:

     Listener ID: 1
    @@ -1069,34 +1099,42 @@ contain an invalid value (e.g. given contentDirURI is an empty string).
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1152,31 +1190,38 @@ developers to add a listener and get notified when content is added, removed or
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1216,9 +1261,9 @@ developers to add a listener and get notified when content is added, removed or
    -

    Code example:

     tizen.content.unsetChangeListener();
    -
    - 
    +

    Code example:

    +tizen.content.unsetChangeListener();
    +
    @@ -1277,24 +1322,28 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1363,50 +1412,58 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1469,44 +1526,51 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1571,18 +1635,22 @@ AbortError: In case of any error.
    -

    Code example:

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

    Code example:

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

    Output example:

     The thumbnail path is /home/owner/share/media/.thumb/phone/.jpg-bed1d5f494830f7a52e1217f1e924aff.jpg
    @@ -2820,59 +2888,71 @@ UnknownError: In case of any error              
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2935,69 +3015,82 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3066,38 +3159,46 @@ UnknownError: In case of any error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3162,74 +3263,89 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3307,69 +3423,84 @@ UnknownError: In case of any other error
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/console.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/console.html index 793d0c5..e323542 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/console.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/console.html @@ -3,7 +3,7 @@ -Console API +Console API
    @@ -121,8 +121,7 @@ The text will be logged as a standard message.
    -

    Code example:

     console.log('A is for Alice.');
    - 
    +

    Code example:

    console.log('A is for Alice.');

    Output example:

    A is for Alice.
    @@ -153,8 +152,7 @@ The text will be logged as an error message.
             
     
    -

    Code example:

     console.error('B is for Bob.');
    - 
    +

    Code example:

    console.error('B is for Bob.');

    Output example:

    B is for Bob.
    @@ -185,8 +183,7 @@ The text will be logged as a warning message.
             
     
    -

    Code example:

     console.warn('C is for Christopher.');
    - 
    +

    Code example:

    console.warn('C is for Christopher.');

    Output example:

    C is for Christopher.
    @@ -217,8 +214,7 @@ The text will be logged as an info message.
             
     
    -

    Code example:

     console.info('D is for Dorothy.');
    - 
    +

    Code example:

    console.info('D is for Dorothy.');

    Output example:

    D is for Dorothy.
    @@ -249,8 +245,7 @@ The text will be logged as a debug message.
             
     
    -

    Code example:

     console.debug('E is for Eve.');
    - 
    +

    Code example:

    console.debug('E is for Eve.');

    Output example:

    E is for Eve.
    @@ -285,11 +280,12 @@ the message is written to the console.
             
     
    -

    Code example:

     var felix = 'Felix';
    +

    Code example:

    +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.');
    - 
    +/* This assertion checks whether the first letter in name 'Felix' is 'A' */ +console.assert(felix.charAt(0) === 'A', felix + ' does not start with A.'); +

    Output example:

    Felix does not start with A.
    @@ -321,9 +317,10 @@ Object view is forced.
             
     
    -

    Code example:

     var john = {name: "John", surname: "Doe"};
    - console.dir(john.name);
    - 
    +

    Code example:

    +var john = {name: "John", surname: "Doe"};
    +console.dir(john.name);
    +

    Output example:

    John
    @@ -354,9 +351,10 @@ if possible or the JavaScript Object if it is not.
             
     
    -

    Code example:

     var john = {name: "John", surname: "Doe"};
    - console.dirxml(john.surname);
    - 
    +

    Code example:

    +var john = {name: "John", surname: "Doe"};
    +console.dirxml(john.surname);
    +

    Output example:

    Doe
    @@ -388,13 +386,15 @@ is displayed in the console. Timer values are accurate to the sub-millisecond.
             
     
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +

    Output example:

    Big array initialization: 461.989ms
    @@ -424,13 +424,15 @@ is displayed in the console. Timer values are accurate to the sub-millisecond.
             
     
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +

    Output example:

    Big array initialization: 461.989ms
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/cordova.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/cordova.html
    index 31b3dd8..6d96f02 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/cordova.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/cordova.html
    @@ -3,7 +3,7 @@
     
     
     
    -Cordova API
    +Cordova API
     
     
     
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device-motion.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device-motion.html index 9d48e14..2130818 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device-motion.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device-motion.html @@ -3,7 +3,7 @@ -DeviceMotion API +DeviceMotion API

    Output example:

    Acceleration X: 0.00
    @@ -197,22 +200,25 @@ Timestamp: 1456480118000
     
             
    -

    Code example:

     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...');
    - };
    +

    Code example:

    +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);
    - 
    +var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options); +

    Output example:

    Acceleration X: 0.00
    @@ -259,26 +265,30 @@ Please wait 3 seconds for the next measurement...
     
             
    -

    Code example:

     var counter = 0, watchID;
    +

    Code example:

    +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);
    - 
    +watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options); +

    Output example:

    Acceleration X: 0.00
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device.html
    index e64876e..dcacaba 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/device.html
    @@ -3,7 +3,7 @@
     
     
     
    -Device API
    +Device API
     
     
     
     
     
     
     
     

    Output example:

    Device Version: 3.0
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/dialogs.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/dialogs.html
    index bfee537..3625992 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/dialogs.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/dialogs.html
    @@ -3,7 +3,7 @@
     
     
     
    -Dialogs API
    +Dialogs API
     
     
     
    @@ -140,13 +140,15 @@ The navigator.notification object allows access to the Dialogs API.
    -

    Code example:

     var alertDismissed = function() {
    -    console.log('Alert was dismissed');
    - }
    +

    Code example:

    +var alertDismissed = function()
    +{
    +   console.log('Alert was dismissed');
    +}
     
    - navigator.notification.alert('Please click OK button', alertDismissed,
    -                              'OK click alert', 'OK');
    - 
    +navigator.notification.alert('Please click OK button', alertDismissed, +                             'OK click alert', 'OK'); +

    Output example:

    Alert was dismissed
    @@ -189,13 +191,15 @@ Callback provides index of button pressed (1,2,3 etc.) or 0, if dialog was dismi
             
     
    -

    Code example:

     var confirmCallback = function(buttonIndex) {
    -    console.log('Selected option was ' + buttonIndex);
    - }
    +

    Code example:

    +var confirmCallback = function(buttonIndex)
    +{
    +   console.log('Selected option was ' + buttonIndex);
    +}
     
    - navigator.notification.confirm('Choose one option', confirmCallback,
    -                              'Options', ['Option1', 'Option2']);
    - 
    +navigator.notification.confirm('Choose one option', confirmCallback, +                               'Options', ['Option1', 'Option2']); +

    Output example:

    Selected option was 1
    @@ -242,16 +246,15 @@ Callback provides PromptData object, which holds all data provided by u
             
     
    -

    Code example:

     var promptCallback = function(results) {
    -    console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
    - }
    +

    Code example:

    +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');
    - 
    +navigator.notification.prompt('Please enter your name', promptCallback, +                              'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe'); +

    Output example:

    Hello Jane Doe, you selected option 1
    @@ -281,10 +284,11 @@ Callback provides PromptData object, which holds all data provided by u
             
     
    -

    Code example:

     var times = 2;
    - console.log('Device would beep ' + times + ' times');
    - navigator.notification.beep(times);
    - 
    +

    Code example:

    +var times = 2;
    +console.log('Device would beep ' + times + ' times');
    +navigator.notification.beep(times);
    +
    @@ -243,16 +245,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova pause event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('pause', onPause, false);
    - }
    -
    - function onPause() {
    -   // Handle the pause event
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('pause', onPause, false);
    +}
    +
    +function onPause()
    +{
    +   /* Handle the pause event */
    +}
    +
    @@ -279,16 +284,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova resume event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('resume', onResume, false);
    - }
    -
    - function onResume() {
    -   // Handle the resume event
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('resume', onResume, false);
    +}
    +
    +function onResume()
    +{
    +   /* Handle the resume event */
    +}
    +
    @@ -313,16 +321,19 @@ It is no longer necessary to call any other method to override the back-button b Original documentation: Cordova backbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('backbutton', onBackKeyDown, false);
    - }
    -
    - function onBackKeyDown() {
    -    // Handle the back button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('backbutton', onBackKeyDown, false);
    +}
    +
    +function onBackKeyDown()
    +{
    +   /* Handle the back button */
    +}
    +
    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('menubutton', onMenuKeyDown, false);
    - }
    -
    - function onMenuKeyDown() {
    -   // Handle the back button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('menubutton', onMenuKeyDown, false);
    +}
    +
    +function onMenuKeyDown()
    +{
    +   /* Handle the back button */
    +}
    +
    @@ -385,16 +399,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova searchbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('searchbutton', onSearchKeyDown, false);
    - }
    -
    - function onSearchKeyDown() {
    -   // Handle the search button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('searchbutton', onSearchKeyDown, false);
    +}
    +
    +function onSearchKeyDown()
    +{
    +   /* Handle the search button */
    +}
    +
    @@ -421,16 +438,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova startcallbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('startcallbutton', onStartCallKeyDown, false);
    - }
    -
    - function onStartCallKeyDown() {
    -   // Handle the start call button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('startcallbutton', onStartCallKeyDown, false);
    +}
    +
    +function onStartCallKeyDown()
    +{
    +   /* Handle the start call button */
    +}
    +
    @@ -457,16 +477,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova endcallbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('endcallbutton', onEndCallKeyDown, false);
    - }
    -
    - function onEndCallKeyDown() {
    -   // Handle the end call button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('endcallbutton', onEndCallKeyDown, false);
    +}
    +
    +function onEndCallKeyDown()
    +{
    +   /* Handle the end call button */
    +}
    +
    @@ -493,16 +516,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova volumedownbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
    - }
    -
    - function onVolumeDownKeyDown() {
    -   // Handle the volume down button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
    +}
    +
    +function onVolumeDownKeyDown()
    +{
    +   /* Handle the volume down button */
    +}
    +
    @@ -529,16 +555,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova volumeupbutton event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    -
    - function onDeviceReady() {
    -   document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
    - }
    -
    - function onVolumeUpKeyDown() {
    -   // Handle the volume up button
    - }
    - 
    +

    Code example:

    +document.addEventListener('deviceready', onDeviceReady, false);
    +
    +function onDeviceReady()
    +{
    +   document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
    +}
    +
    +function onVolumeUpKeyDown()
    +{
    +   /* Handle the volume up button */
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/file.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/file.html index 42ec325..359bbbe 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/file.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/file.html @@ -3,7 +3,7 @@ -File API +File API

    Constructors

    @@ -501,8 +503,7 @@ This manager interface exposes the Filesystem base API constants. 3.0

    -

    Code example:

     console.log("The directory where the application is installed " + cordova.file.applicationDirectory);
    - 
    +

    Code example:

    console.log("The directory where the application is installed " + cordova.file.applicationDirectory);

    Output example:

    The directory where the application is installed file:///opt/usr/apps/WfigBlWDyf/res/wgt/
    @@ -519,8 +520,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);
    - 
    +

    Code example:

    console.log("Root directory of the application's sandbox " + cordova.file.applicationStorageDirectory);

    Output example:

    Root directory of the application's sandbox file:///opt/usr/apps/WfigBlWDyf/
    @@ -537,8 +537,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Data directory " + cordova.file.dataDirectory);
    - 
    +

    Code example:

    console.log("Data directory " + cordova.file.dataDirectory);

    Output example:

    Data directory file:///opt/usr/apps/WfigBlWDyf/data/
    @@ -555,8 +554,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Cache directory " + cordova.file.cacheDirectory);
    - 
    +

    Code example:

    console.log("Cache directory " + cordova.file.cacheDirectory);

    Output example:

    Cache directory file:///opt/usr/apps/WfigBlWDyf/tmp/
    @@ -573,8 +571,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);
    - 
    +

    Code example:

    console.log("Space on external storage " + cordova.file.externalApplicationStorageDirectory);

    Output example:

    Space on external storage null
    @@ -591,8 +588,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Data files on external storage " + cordova.file.externalDataDirectory);
    - 
    +

    Code example:

    console.log("Data files on external storage " + cordova.file.externalDataDirectory);

    Output example:

    Data files on external storage null
    @@ -609,8 +605,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Cache on external storage " + cordova.file.externalCacheDirectory);
    - 
    +

    Code example:

    console.log("Cache on external storage " + cordova.file.externalCacheDirectory);

    Output example:

    Cache on external storage null
    @@ -627,8 +622,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Root on external storage " + cordova.file.externalRootDirectory);
    - 
    +

    Code example:

    console.log("Root on external storage " + cordova.file.externalRootDirectory);

    Output example:

    Root on external storage file:///usr/storage/sdcard/
    @@ -645,8 +639,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Temp directory " + cordova.file.tempDirectory);
    - 
    +

    Code example:

    console.log("Temp directory " + cordova.file.tempDirectory);

    Output example:

    Temp directory null
    @@ -663,8 +656,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Synced data directory " + cordova.file.syncedDataDirectory);
    - 
    +

    Code example:

    console.log("Synced data directory " + cordova.file.syncedDataDirectory);

    Output example:

    Synced data directory null
    @@ -681,8 +673,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Documents directory " + cordova.file.documentsDirectory);
    - 
    +

    Code example:

    console.log("Documents directory " + cordova.file.documentsDirectory);

    Output example:

    Documents directory null
    @@ -699,8 +690,7 @@ This manager interface exposes the Filesystem base API constants.
      3.0
                 

    -

    Code example:

     console.log("Files globally available to all applications " + cordova.file.sharedDirectory);
    - 
    +

    Code example:

    console.log("Files globally available to all applications " + cordova.file.sharedDirectory);

    Output example:

    Files globally available to all applications file:///opt/usr/media/
    @@ -743,10 +733,12 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
      3.0
                 

    -

    Code example:

     requestFileSystem(TEMPORARY, 100, function (fileSystem) {
    -        console.log('Name of the filesystem: '+fileSystem.name);
    - });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fileSystem)
    +{
    +   console.log('Name of the filesystem: ' + fileSystem.name);
    +});
    +

    Output example:

    Name of the filesystem: temporary
    @@ -1007,17 +999,19 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

     successCallback = function(fs) {
    -     console.log('File system name ' + fs.name);
    - };
    -
    - errorCallback = function(err) {
    -     console.log(err.code);
    - };
    -
    - requestFileSystem(TEMPORARY, 1024*1024, successCallback, errorCallback);
    -
    - 
    +

    Code example:

    +successCallback = function(fs)
    +{
    +   console.log('File system name ' + fs.name);
    +};
    +
    +errorCallback = function(err)
    +{
    +   console.log(err.code);
    +};
    +
    +requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
    +

    Output example:

    File system name temporary
    @@ -1070,18 +1064,20 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Entry name example.txt
    @@ -1224,12 +1220,15 @@ The specifics of naming filesystems is unspecified, but a name must be unique ac
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getMetadata(function (metadata) {
    -       console.log("Last modification time: " + metadata.modificationTime);// get metadata successfully
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getMetadata(function(metadata)
    +   {
    +      console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
    +   });
    +});
    +

    Output example:

    Last modification time: Fri Jan 02 2015 03:58:08 GMT+0900 (KST)
    @@ -1311,16 +1310,21 @@ A move of a directory on top of an existing empty directory must attempt to dele
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Full path before move: /aa.txt
    @@ -1404,18 +1408,20 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    Full path to the copied file: /testDirectory/newname.txt
    @@ -1464,12 +1470,15 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getParent(function (entry) {
    -       console.log("success");
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getParent(function(entry)
    +   {
    +      console.log("success");
    +   });
    +});
    +

    Output example:

    success
    @@ -1522,14 +1531,18 @@ Directory copies are always recursive--that is, they copy all contents of the di
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile('test.txt', {create: true}, function(fileEntry) {
    -       fileEntry.remove(function () {
    -         console.log("success");
    -       });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile('test.txt', {create: true}, function(fileEntry)
    +   {
    +      fileEntry.remove(function()
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -1554,14 +1567,16 @@ Directory copies are always recursive--that is, they copy all contents of the di
      URL that can be used to identify this entry.
                   
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory('testDirectory', {create:true},
    -       function(entry) {
    -         var url = entry.toURL();
    -         console.log('URL: '+url);
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory('testDirectory', {create:true}, function(entry)
    +   {
    +      var url = entry.toURL();
    +      console.log('URL: ' + url);
    +   });
    +});
    +

    Output example:

    URL: file:///home/owner/apps_rw/WfigBlWDyf/tmp/testDirectory/
    @@ -1620,12 +1635,15 @@ Directory copies are always recursive--that is, they copy all contents of the di
      DirectoryReader
                   
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function (entry) {
    -     entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry) {
    -          var directoryReader = dirEntry.createReader();
    -      });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(entry)
    +{
    +   entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
    +   {
    +      var directoryReader = dirEntry.createReader();
    +   });
    +});
    +
    @@ -1696,12 +1714,15 @@ Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry c
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory("ert",{create:true},function(dir){
    -         console.log('Created dir: '+dir.name);
    -      })
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory("ert", {create:true}, function(dir)
    +   {
    +      console.log('Created dir: ' + dir.name);
    +   })
    +});
    +

    Output example:

    Created dir: ert
    @@ -1776,12 +1797,15 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile("qa.txt",{create:true},function(file){
    -           console.log('Created file: '+file.name);
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile("qa.txt", {create:true}, function(file)
    +   {
    +      console.log('Created file: ' + file.name);
    +   });
    +});
    +

    Output example:

    Created file: qa.txt
    @@ -1834,15 +1858,18 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getDirectory("testDirectory", {create:true},
    -       function(directoryEntry) {
    -         directoryEntry.removeRecursively(function() {
    -           console.log("success");
    -         });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
    +   {
    +      directoryEntry.removeRecursively(function()
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -1906,13 +1933,16 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
     
             
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     var a = fs.root.createReader();
    -     a.readEntries(function successCallback(entries) {
    -       console.log("success");
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   var a = fs.root.createReader();
    +   a.readEntries(function successCallback(entries)
    +   {
    +      console.log("success");
    +   });
    +});
    +

    Output example:

    success
    @@ -1976,20 +2006,26 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
             
     
    -

    Code example:

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

    Code example:

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

    Output example:

    success
    @@ -2031,14 +2067,18 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
             
     
    -

    Code example:

       requestFileSystem(TEMPORARY, 100, function(fs) {
    -     fs.root.getFile("abcdz.txt", {create: true}, function (f) {
    -       f.file(function (file) {
    -         console.log("success");
    -       });
    -     });
    -   });
    - 
    +

    Code example:

    +requestFileSystem(TEMPORARY, 100, function(fs)
    +{
    +   fs.root.getFile("abcdz.txt", {create: true}, function(f)
    +   {
    +      f.file(function(file)
    +      {
    +         console.log("success");
    +      });
    +   });
    +});
    +

    Output example:

    success
    @@ -2090,12 +2130,14 @@ Otherwise, if no other error occurs, getFile must return a FileEntry correspondi
      3.0
               

    -

    Code example:

     var deviceReady, fileReader;
    - deviceReady = function() {
    -     fileReader = new FileReader();
    - };
    - document.addEventListener('deviceready', deviceReady, true);
    - 
    +

    Code example:

    +var deviceReady, fileReader;
    +deviceReady = function()
    +{
    +   fileReader = new FileReader();
    +};
    +document.addEventListener('deviceready', deviceReady, true);
    +

    Constructors

    @@ -2236,17 +2278,20 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read 3.0

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +

    Output example:

    aborted
    @@ -2295,13 +2340,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    -  fileReader.readAsDataURL(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsDataURL(blob);
    +

    Output example:

    Loaded, result = data:;base64,YWJj
    @@ -2354,13 +2401,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    - fileReader.readAsText(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsText(blob);
    +

    Output example:

    Loaded, result = abc
    @@ -2409,13 +2458,15 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     console.log('Loaded, result = '+fileReader.result);
    - };
    - fileReader.readAsBinaryString(blob);
    - 
    +

    Code example:

    +var blob = new Blob(['abc']);
    +var fileReader = new FileReader();
    +fileReader.onload = function()
    +{
    +   console.log('Loaded, result = ' + fileReader.result);
    +};
    +fileReader.readAsBinaryString(blob);
    +

    Output example:

    Loaded, result = abc
    @@ -2464,14 +2515,16 @@ Returns a Blob's data as a DOMString, or byte[], or null, depending on the read
     
             
    -

    Code example:

     var blob = new Blob(['abc']);
    - var fileReader = new FileReader();
    - fileReader.onload = function(){
    -     resultValue = fileReader.result;
    -      console.log("Result: "+resultValue.toString()+'
    '+'ByteLength: '+resultValue.byteLength); - }; - fileReader.readAsArrayBuffer(blob); -
    +

    Code example:

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

    Output example:

    Result: [object ArrayBuffer]
    @@ -2660,24 +2713,29 @@ ByteLength: 3
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    abort
    @@ -2719,18 +2777,21 @@ If the offset is a negative number the position of the file pointer is rewound.
     
             
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2771,21 +2832,25 @@ If the offset is a negative number the position of the file pointer is rewound.
    -

    Code example:

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

    Code example:

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

    Output example:

    truncate success
    @@ -2834,21 +2899,25 @@ If the offset is a negative number the position of the file pointer is rewound.
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

    write success
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/filetransfer.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/filetransfer.html
    index 3778ad6..e7d6dee 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/filetransfer.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/filetransfer.html
    @@ -3,7 +3,7 @@
     
     
     
    -FileTransfer API
    +FileTransfer API
     
     
     
    @@ -169,34 +169,37 @@ The key / value type of download options values. Currently only supports header 3.0

    -

    Code example:

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

    Code example:

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

    Output example:

    Code = 200
    @@ -209,9 +212,10 @@ Sent = 1024
     
    FileUploadOptions(DOMString fileKey, DOMString fileName, DOMString mimeType, FileUploadParams params, HeaderFields headers, DOMString httpMethod);
    -

    Code example:

     // Creates a FileUploadOptions object.
    - var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
    - 
    +

    Code example:

    +/* Creates a FileUploadOptions object */
    +var options = new FileUploadOptions('file', 'doc.txt', 'text/plain', null, null, 'POST');
    +
    @@ -502,9 +506,10 @@ Sent = 1024
    FileTransfer();
    -

    Code example:

     // Creates a FileTransfer object.
    - var file_transfer = new FileTransfer();
    - 
    +

    Code example:

    +/* Creates a FileTransfer object */
    +var file_transfer = new FileTransfer();
    +
    @@ -519,32 +524,36 @@ Sent = 1024 3.0

    -

    Code example:

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

    Code example:

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

    Output example:

    uploaded: 512
     uploaded: 1024
    -Success.  File uploaded.
    +Success. File uploaded.
     
    @@ -607,23 +616,26 @@ Success. File uploaded.
    -

    Code example:

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

    Code example:

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

    Output example:

    Code = 200
    @@ -687,30 +699,28 @@ Sent = 1024
             
     
    -

    Code example:

     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=='
    -     }
    -   }
    - );
    - 
    +

    Code example:

    +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=='
    +   }
    +});
    +

    Output example:

    download complete: file:///home/owner/apps_rw/Gk6hf8hjk/tmp/file.txt
    @@ -739,26 +749,29 @@ Sent = 1024
      http://tizen.org/privilege/internet
                 

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +
    -

    Output example:

    An error has occured: Code = 4
    +

    Output example:

    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
     
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/globalization.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/globalization.html index 8140d67..b48ed50 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/globalization.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/globalization.html @@ -3,7 +3,7 @@ -Globalization API +Globalization API
    @@ -263,15 +263,20 @@ during this method's execution.
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    Language: en-US
    @@ -323,15 +328,20 @@ occuring while getting a locale name.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    Locale: en-US
    @@ -387,17 +397,20 @@ passed as a parameter to the successCallback.
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    Date: 9/25/2012 4:21PM
    @@ -450,24 +463,25 @@ for example 'USD'.
     
             
    -

    Code example:

     // 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.'); }
    - );
    -
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    pattern: $#,##0.##;($#,##0.##)
    @@ -527,20 +541,23 @@ The default value is {type: 'wide', item: 'months'}                
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    month: January
    @@ -604,20 +621,25 @@ The default value is {formatLength: 'short', selector: 'date and time'}
             
    -

    Code example:

     // 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();
    - 
    +

    Code example:

    +/*
    +   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();
    +

    Output example:

    Date pattern: M/d/yyyy h:mm a
    @@ -667,14 +689,19 @@ the first day of a week.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    day: 1
    @@ -729,26 +756,26 @@ the pattern will be returned.
     
             
    -

    Code example:

     // 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' }
    - );
    -
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    pattern: #,##0.###
    @@ -811,16 +838,19 @@ errors occuring during this method's execution.
     
             
    -

    Code example:

     // 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.'); }
    - );
    - 
    +

    Code example:

    +/*
    +   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.');
    +});
    +

    Output example:

    dst: true
    @@ -884,37 +914,43 @@ The default value of this parameter is {type: 'decimal'}.
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    decimal number: 3.142
    @@ -973,22 +1009,23 @@ The default value is {formatLength: 'short', selector: 'date and time'}
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    month: 8, day: 25, year: 2012
    @@ -1047,16 +1084,19 @@ The default value is {type: 'decimal'}                
     
             
    -

    Code example:

     // 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' }
    - );
    - 
    +

    Code example:

    +/*
    +   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'});
    +

    Output example:

    number: 1234.56
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/media.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/media.html
    index ad1f581..da409ca 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/media.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/media.html
    @@ -3,7 +3,7 @@
     
     
     
    -Media API
    +Media API
     
     
     
     
     

    Output example:

    Audio file has been played back.
    @@ -290,20 +294,23 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio duration is 281.035
    @@ -324,31 +331,36 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio file has been paused.
    @@ -369,19 +381,22 @@ Current position is 2.000
      3.0
                 

    -

    Code example:

     successCallback = function() {
    -    console.log('Audio file has been played back.');
    - }
    +

    Code example:

    +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();
    - 
    +myMedia.play(); +

    Output example:

    Audio file has been played back.
    @@ -403,21 +418,24 @@ Applications should call the release function for any Media resource that is no
      3.0
                 

    -

    Code example:

     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();
    - 
    +

    Code example:

    +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();
    +

    Output example:

    Audio file has been stopped or released.
    @@ -448,24 +466,28 @@ Audio file has been stopped or released.
             
     
    -

    Code example:

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

    Code example:

    +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);
      
    @@ -505,31 +527,36 @@ Audio file has been played back.
    -

    Code example:

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

    Code example:

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

    Output example:

    Playback volume has been muted.
    @@ -560,19 +587,22 @@ Audio file has been played back.
      http://tizen.org/privilege/mediacapture
                 

    -

    Code example:

     successCallback = function() {
    -    console.log('Started recording an audio file.');
    - }
    +

    Code example:

    +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();
    - 
    +myRecMedia.startRecord(); +

    Output example:

    Started recording an audio file.
    @@ -601,25 +631,29 @@ Audio file has been played back.
      http://tizen.org/privilege/mediacapture
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Started recording an audio file.
    @@ -641,24 +675,28 @@ Stopped recording an audio file.
      3.0
                 

    -

    Code example:

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

    Code example:

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

    Output example:

    Audio playback has been stopped.
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/networkInformation.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/networkInformation.html
    index 0fbe5ff..20b6da0 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/networkInformation.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/cordova/networkInformation.html
    @@ -3,7 +3,7 @@
     
     
     
    -NetworkInformation API
    +NetworkInformation API
     
     
     
    @@ -112,23 +112,25 @@ The navigator.connection object allows access to the NetworkInformation http://tizen.org/privilege/telephony

    -

    Code example:

     function checkConnection() {
    -   var networkState = navigator.connection.type;
    +

    Code example:

    +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();
    - 
    +checkConnection(); +

    Output example:

    Connection type: Cell 3G connection
    @@ -165,8 +167,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.UNKNOWN);
    - 
    +

    Code example:

    console.log(Connection.UNKNOWN);

    Output example:

    unknown
    @@ -183,8 +184,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.ETHERNET);
    - 
    +

    Code example:

    console.log(Connection.ETHERNET);

    Output example:

    ethernet
    @@ -201,8 +201,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.WIFI);
    - 
    +

    Code example:

    console.log(Connection.WIFI);

    Output example:

    wifi
    @@ -219,8 +218,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_2G);
    - 
    +

    Code example:

    console.log(Connection.CELL_2G);

    Output example:

    2g
    @@ -237,8 +235,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_3G);
    - 
    +

    Code example:

    console.log(Connection.CELL_3G);

    Output example:

    3g
    @@ -255,8 +252,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL_4G);
    - 
    +

    Code example:

    console.log(Connection.CELL_4G);

    Output example:

    4g
    @@ -273,8 +269,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.CELL);
    - 
    +

    Code example:

    console.log(Connection.CELL);

    Output example:

    cellular
    @@ -291,8 +286,7 @@ The navigator.connection object allows access to the NetworkInformation
      3.0
                 

    -

    Code example:

     console.log(Connection.NONE);
    - 
    +

    Code example:

    console.log(Connection.NONE);

    Output example:

    none
    @@ -326,16 +320,19 @@ Applications typically should use document.addEventListener() to attach an event
     Original documentation: Cordova online event          

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    +

    Code example:

    +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
    - }
    - 
    +function onOnline() +{ +   /* Handle the online event */ +} +
    @@ -362,16 +359,19 @@ Applications typically should use document.addEventListener() to attach an event Original documentation: Cordova offline event

    -

    Code example:

     document.addEventListener('deviceready', onDeviceReady, false);
    +

    Code example:

    +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
    - }
    - 
    +function onOffline() +{ +   /* Handle the offline event */ +} +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/datacontrol.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/datacontrol.html index d1e6a30..801422d 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/datacontrol.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/datacontrol.html @@ -231,25 +231,34 @@ DataControl API.
    -

    Code example:

     //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.
    +

    Code example:

    +/* 
    +   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);
    - }
    - 
    +/* 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); +} +
    @@ -398,29 +407,34 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id, insertRowId)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    @@ -488,29 +502,34 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    @@ -574,25 +593,29 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -672,46 +695,49 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

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

    Code example:

    +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);
    - }
    -
    - 
    +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); +} +
    @@ -812,25 +838,29 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -901,25 +931,29 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -986,25 +1020,29 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function getValueSuccessCB(result, id)
    - {
    -     console.log(result.length + ":" + result[0]);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +try +{ +   /* Defines globalReqId before */ +   /* Increases globalReqId for uniqueness */ +   globalReqId++; +   globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -1079,25 +1117,29 @@ The string consists of one or more components, separated by a slash('/').
    -

    Code example:

     function successcb(id)
    - {
    -     console.log("ok : reqid " + id);
    - }
    +

    Code example:

    +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);
    - }
    - 
    +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); +} +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/download.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/download.html index feff51c..ec469ad 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/download.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/download.html @@ -279,11 +279,12 @@ The default value is an empty object. 2.1

    -

    Code example:

     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";
    - 
    +

    Code example:

    +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";
    +
    @@ -384,47 +385,59 @@ If the network is not available for downloading, the return value is -1 since Ti
    -

    Code example:

     // 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;
    - }
    +

    Code example:

    +/* 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");
     
    - 
    +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."); +} +
    @@ -468,9 +481,10 @@ If the network is not available for downloading, the return value is -1 since Ti
    -

    Code example:

     // Cancels the ongoing download operation with the specified ID.
    - tizen.download.cancel(downloadId);
    - 
    +

    Code example:

    +/* Cancels the ongoing download operation with the specified ID */
    +tizen.download.cancel(downloadId);
    +
    @@ -515,9 +529,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Pauses the ongoing download operation with the specified ID.
    - tizen.download.pause(downloadId);
    - 
    +

    Code example:

    +/* Pauses the ongoing download operation with the specified ID */
    +tizen.download.pause(downloadId);
    +
    @@ -561,9 +576,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Resumes the paused download operation with the specified ID.
    - tizen.download.resume(downloadId);
    - 
    +

    Code example:

    +/* Resumes the paused download operation with the specified ID */
    +tizen.download.resume(downloadId);
    +
    @@ -611,9 +627,10 @@ The paused download operation can be resumed later by the resume() meth
    -

    Code example:

     // Gets the state of the download operation with the given ID.
    - var state = tizen.download.getState(downloadId);
    - 
    +

    Code example:

    +/* Gets the state of the download operation with the given ID */
    +var state = tizen.download.getState(downloadId);
    +
    @@ -664,9 +681,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Gets the download request information with the given ID.
    - var downloadRequest = tizen.download.getDownloadRequest(downloadId);
    - 
    +

    Code example:

    +/* Gets the download request information with the given ID */
    +var downloadRequest = tizen.download.getDownloadRequest(downloadId);
    +
    @@ -721,9 +739,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Get the MIME type of the download operation with the given ID.
    - var MIMEtype = tizen.download.getMIMEType(downloadId);
    - 
    +

    Code example:

    +/* Get the MIME type of the download operation with the given ID */
    +var MIMEtype = tizen.download.getMIMEType(downloadId);
    +
    @@ -775,31 +794,38 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    - 
    +/* Add the listener */ +tizen.download.setListener(downloadId, listener); +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/exif.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/exif.html index de58318..7b8ea7d 100755 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/exif.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/exif.html @@ -250,27 +250,33 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -324,41 +330,47 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    -
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -419,33 +431,39 @@ UnknownError: In any other error case
    -

    Code example:

     //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);
    - 
    +

    Code example:

    +/* 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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/feedback.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/feedback.html index ccbd8a7..261ab8a 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/feedback.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/feedback.html @@ -320,12 +320,16 @@ If this method is called without the type value, patterns are
    -

    Code example:

     try {
    -     tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
    - } catch (err) {
    -     console.log (err.name +': ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
    +}
    +catch (err)
    +{
    +   console.log(err.name + ': ' + err.message);
    +}
    +
    @@ -357,13 +361,17 @@ This function can be used to stop various types of vibration reactions that are
    -

    Code example:

     try {
    -     tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
    -     tizen.feedback.stop();
    - } catch (err) {
    -     console.log (err.name +': ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
    +   tizen.feedback.stop();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ': ' + err.message);
    +}
    +
    @@ -409,14 +417,16 @@ This function can be used to stop various types of vibration reactions that are
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +

    Output example:

     pattern BT_CONNECTED is supported
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/filesystem.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/filesystem.html
    index cf4e9e0..a292656 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/filesystem.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/filesystem.html
    @@ -357,41 +357,44 @@ as determining root and default locations, resolving a given location into a fil
               

    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +

    Attributes

    @@ -405,8 +408,9 @@ as determining root and default locations, resolving a given location into a fil 1.0

    -

    Code example:

     console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
    - 
    +

    Code example:

    +console.log("The maximum path length is " + tizen.filesystem.maxPathLength);
    +
    @@ -520,15 +524,15 @@ UnknownError - If any other error occurs.
    -

    Code example:

     tizen.filesystem.resolve(
    -   'images',
    -   function(dir) {
    -     console.log("Mount point Name is " +  dir.path);
    -   }, function(e) {
    -     console.log("Error: " + e.message);
    -   }, "r"
    - );
    - 
    +

    Code example:

    +tizen.filesystem.resolve('images', function(dir)
    +{
    +   console.log("Mount point Name is " +  dir.path);
    +}, function(e)
    +{
    +   console.log("Error: " + e.message);
    +}, "r");
    +
    @@ -598,16 +602,19 @@ UnknownError - If any other error occurs.
    -

    Code example:

     function onStorage(storage) {
    -     // Do something
    - }
    +

    Code example:

    +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);
    - 
    +tizen.filesystem.getStorage("music", onStorage, onStorageError); +
    @@ -676,17 +683,20 @@ UnknownError - If any other error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -754,14 +764,16 @@ The watch operation must continue until the removeStorageStateChangeListener() m
    -

    Code example:

     var watchID;
    - function onStorageStateChanged(storage) {
    -     if (storage.state == "MOUNTED")
    -         console.log("Storage " + storage.label + " was added!");
    - }
    +

    Code example:

    +var watchID;
    +function onStorageStateChanged(storage)
    +{
    +   if (storage.state == "MOUNTED")
    +      console.log("Storage " + storage.label + " was added!");
    +}
     
    - watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
    - 
    +watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged); +
    @@ -813,16 +825,17 @@ Otherwise, the method call has no effect.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -986,21 +999,25 @@ files and directories rooted as the file handle location.

    -

    Code example:

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

    Code example:

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

    Attributes

    @@ -1020,23 +1037,29 @@ This attribute is set tonull if there is no parent directory. This al 1.0

    -

    Code example:

     // 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");
    - }
    - 
    +

    Code example:

    +/* 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");
    +}
    +
  • @@ -1063,22 +1086,26 @@ This attribute represents the actual state of a file or directory in the filesys 1.0

    -

    Code example:

     // 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");
    - }
    - 
    +

    Code example:

    +/* 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");
    +}
    +
  • @@ -1168,8 +1195,7 @@ timestamp changes when a file is moved. 1.0

    -

    Code example:

     console.log(file.modified); // displays the modification timestamp
    - 
    +

    Code example:

    console.log(file.modified); /* Displays the modification timestamp */
  • @@ -1203,8 +1229,7 @@ For example, if the root is music, then the path is music. If the root is docume 1.0

    -

    Code example:

     console.log(file.path); // should be 'music/' if the file is music/foo.mp3
    - 
    +

    Code example:

    console.log(file.path); /* Must be 'music/' if the file is music/foo.mp3 */
  • @@ -1233,9 +1258,10 @@ For the special case of the root itself, the name is an empty string. 1.0

    -

    Code example:

     // should be foo.mp3 if the file path is music/foo.mp3
    - console.log(file.name);
    - 
    +

    Code example:

    +/* Must be foo.mp3 if the file path is music/foo.mp3 */
    +console.log(file.name);
    +
  • @@ -1266,9 +1292,10 @@ The fullPath is always equal to path + name. 1.0

    -

    Code example:

      // should be music/track1.mp3 if the file is music/track1.mp3
    - console.log(file.fullPath);
    - 
    +

    Code example:

    +/* Must be music/track1.mp3 if the file is music/track1.mp3 */
    +console.log(file.fullPath);
    +
  • @@ -1286,9 +1313,10 @@ If an attempt to read this attribute for a directory is made, undefined
    -

    Code example:

     // displays the file size
    - console.log(file.fileSize);
    - 
    +

    Code example:

    +/* Displays the file size */
    +console.log(file.fileSize);
    +
  • @@ -1306,9 +1334,10 @@ If an attempt to read this attribute for a file is made, undefined is 1.0

    -

    Code example:

     // '3' if the directory contains two files and one sub-directory
    - console.log(file.length);
    - 
    +

    Code example:

    +/* '3' if the directory contains two files and one sub-directory */
    +console.log(file.length);
    +
  • @@ -1367,12 +1396,14 @@ These URIs must not be accessible to other widgets, apart from the one invoking
    -

    Code example:

     tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file) {
    -   var audio = new Audio(file.toURI());
    -   audio.play();
    -   console.log(file.toURI());
    - });
    - 
    +

    Code example:

    +tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
    +{
    +   var audio = new Audio(file.toURI());
    +   audio.play();
    +   console.log(file.toURI());
    +});
    +
    @@ -1448,23 +1479,25 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1537,39 +1570,43 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1639,35 +1676,40 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1754,33 +1796,36 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1867,33 +1912,36 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -1970,10 +2018,11 @@ The new File object has "rw" access rights, as it inherits this from th
    -

    Code example:

     var dir; //Directory object obtained from filesystem API
    - var newDir = dir.createDirectory("newDir");
    - var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
    - 
    +

    Code example:

    +var dir; /* Directory object obtained from filesystem API */
    +var newDir = dir.createDirectory("newDir");
    +var anotherNewDir = dir.createDirectory("newDir1/subNewDir1");
    +
    @@ -2045,8 +2094,7 @@ called.
    -

    Code example:

     var newFile = dir.createFile("newFilePath");
    - 
    +

    Code example:

    var newFile = dir.createFile("newFilePath");
    @@ -2117,15 +2165,20 @@ The new File object inherits its access rights from the File o
    -

    Code example:

     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");
    - 
    +

    Code example:

    +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");
    +
    @@ -2208,36 +2261,39 @@ all data in all subdirectories and so needs to be used with caution.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -2309,35 +2365,39 @@ UnknownError - If any other error occurs.
    -

    Code example:

     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"
    - );
    - 
    +

    Code example:

    +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");
    +
    @@ -2528,10 +2588,12 @@ If set to false, this attribute indicates that the file pointer is no 1.0

    -

    Code example:

     if (stream.eof) {
    -   // file has been read completely
    - }
    - 
    +

    Code example:

    +if (stream.eof)
    +{
    +   /* File has been read completely */
    +}
    +
  • @@ -2548,11 +2610,14 @@ The stream position is an offset of bytes from the start of the file stream. Whe 1.0

    -

    Code example:

     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;
    - 
    +

    Code example:

    +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;
    +
  • @@ -2574,8 +2639,8 @@ It corresponds to the number of bytes available after the file pointer denoted b 1.0

    -

    Code example:

     console.log(stream.bytesAvailable); // displays the available bytes to be read
    - 
    +

    Code example:

    +console.log(stream.bytesAvailable); /* Displays the available bytes to be read */
  • @@ -2611,8 +2676,9 @@ Note that pending writes might not succeed. http://tizen.org/privilege/filesystem.read

    -

    Code example:

     stream.close(); // closes this stream, no subsequent access to stream allowed
    - 
    +

    Code example:

    +stream.close(); /* Closes this stream, no subsequent access to stream allowed */
    +
    @@ -2669,9 +2735,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     var text = stream.read(file.fileSize);
    - stream.close();
    - 
    +

    Code example:

    +var text = stream.read(file.fileSize);
    +stream.close();
    +
    @@ -2727,12 +2794,14 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     // 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
    - }
    - 
    +

    Code example:

    +/* 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 */
    +}
    +
    @@ -2768,9 +2837,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     // reads up to 256 bytes from the stream
    - var base64 = stream.readBase64(256);
    - 
    +

    Code example:

    +/* Reads up to 256 bytes from the stream */
    +var base64 = stream.readBase64(256);
    +
    @@ -2819,9 +2889,10 @@ The resulting string length might be shorter than charCount if EOF is <
    -

    Code example:

     var text = "Hello world";
    - stream.write(text);
    - 
    +

    Code example:

    +var text = "Hello world";
    +stream.write(text);
    +
    @@ -2871,10 +2942,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var bytes = in.readBytes(256);
    - // writes the bytes read from in to out
    - out.writeBytes(bytes);
    - 
    +

    Code example:

    +var bytes = in.readBytes(256);
    +/* Writes the bytes read from in to out */
    +out.writeBytes(bytes);
    +
    @@ -2924,10 +2996,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var base64 = in.readBase64(256);
    - // writes the base64 data read from in to out
    - out.writeBase64(base64);
    - 
    +

    Code example:

    +var base64 = in.readBase64(256);
    +/* Writes the base64 data read from in to out */
    +out.writeBase64(base64);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html index 9982659..bb5cc8d 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html @@ -279,17 +279,19 @@ UNKNOWN - Sleep status could not be determined
    -

    Code example:

     function onchangedCB(sleepInfo) {
    -     console.log("Sleep status : " + sleepInfo.status);
    -     console.log("Timestamp : " + sleepInfo.timestamp);
    - }
    -
    - tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
    - 
    +

    Code example:

    +function onchangedCB(sleepInfo)
    +{
    +   console.log("Sleep status: " + sleepInfo.status);
    +   console.log("Timestamp: " + sleepInfo.timestamp);
    +}
    +
    +tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
    +
    -

    Output example:

     Sleep status : ASLEEP
    - Timestamp : 1456735296123
    +

    Output example:

     Sleep status: ASLEEP
    + Timestamp: 1456735296123
      
    @@ -415,28 +417,32 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

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

    Code example:

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

    Output example:

     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
      
    @@ -530,38 +536,47 @@ For other types, only 'http://tizen.org/privilege/healthinfo' should be d
    -

    Code example:

     function onchangedCB(pedometerInfo) {
    -     console.log("Step status : " + pedometerInfo.stepStatus);
    -     console.log("Cumulative total step count : " + pedometerInfo.cumulativeTotalStepCount);
    - }
    -
    - tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
    - 
    +

    Code example:

    +function onchangedCB(pedometerInfo)
    +{
    +   console.log("Step status: " + pedometerInfo.stepStatus);
    +   console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
    +}
    +
    +tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
    +
    -

    Output example:

     Step status : WALKING
    - Cumulative total step count : 100
    +

    Output example:

     Step status: WALKING
    + Cumulative total step count: 100
      
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -624,8 +639,9 @@ For other types, only 'http://tizen.org/privilege/healthinfo' should be d
    -

    Code example:

     tizen.humanactivitymonitor.stop("PEDOMETER");
    - 
    +

    Code example:

    +tizen.humanactivitymonitor.stop("PEDOMETER");
    +
    @@ -682,17 +698,19 @@ Note that the setAccumulativePedometerListener() method does not need to call th
    -

    Code example:

     function onchangedCB(pedometerInfo) {
    -        console.log("Step status : " + pedometerInfo.stepStatus);
    -        console.log("Accumulative total step count : " + pedometerInfo.accumulativeTotalStepCount);
    - }
    -
    - tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
    - 
    +

    Code example:

    +function onchangedCB(pedometerInfo)
    +{
    +   console.log("Step status: " + pedometerInfo.stepStatus);
    +   console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount);
    +}
    +
    +tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
    +
    -

    Output example:

     Step status : WALKING
    - Accumulative total step count : 100
    +

    Output example:

     Step status: WALKING
    + Accumulative total step count: 100
      
    @@ -730,8 +748,8 @@ Note that the setAccumulativePedometerListener() method does not need to call th
    -

    Code example:

     tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
    - 
    +

    Code example:

    tizen.humanactivitymonitor.unsetAccumulativePedometerListener();
    +
    @@ -790,22 +808,28 @@ The ErrorCallback method is launched with this error type:
    -

    Code example:

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

    Code example:

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

    Output example:

     type: WALKING
    @@ -850,26 +874,32 @@ The ErrorCallback method is launched with this error type:
             
     
    -

    Code example:

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

    Code example:

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

    Output example:

     type: WALKING
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/inputdevice.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/inputdevice.html
    index c48d429..63c8151 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/inputdevice.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/inputdevice.html
    @@ -215,22 +215,26 @@ Mandatory keys will not be retrieved by this method.
     
             
    -

    Code example:

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

    Code example:

    +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");
    +   }
    +});
    +
    @@ -315,15 +319,20 @@ An application can not register the mandatory keys (ArrowLeft, ArrowRight, Arrow
    -

    Code example:

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

    Code example:

    +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);
    +   }
    +}
    +
    @@ -361,8 +370,9 @@ An application can not register the mandatory keys (ArrowLeft, ArrowRight, Arrow
    -

    Code example:

     tizen.inputdevice.unregisterKey("VolumeDown");
    - 
    +

    Code example:

    +tizen.inputdevice.unregisterKey("VolumeDown");
    +
    @@ -428,17 +438,20 @@ An application can not register the mandatory keys (ArrowLeft, ArrowRight, Arrow
    -

    Code example:

     function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +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);
    - 
    +var keys = ["VolumeUp", "VolumeDown"]; +tizen.inputdevice.registerKeyBatch(keys, successCB, errorCB); +
    @@ -498,16 +511,20 @@ UnknownError: In case of any other error
    -

    Code example:

     function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +

    Code example:

    +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);
    - 
    +var keys = ["VolumeUp", "VolumeDown"]; +tizen.inputdevice.unregisterKeyBatch(keys, successCB, errorCB); +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/keymanager.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/keymanager.html index b8931f0..c08e2ef 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/keymanager.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/keymanager.html @@ -214,14 +214,16 @@ UnknownError - If the method cannot be completed because of an unknown error.
    -

    Code example:

     var data_name = "data1", raw_data = "my data";
    +

    Code example:

    +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);
    - 
    +tizen.keymanager.saveData(data_name, raw_data, null, onSave); +
    @@ -270,31 +272,36 @@ If an application calls this method to remove data which it saved into the KeyMa
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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]);
    +}
    +
    @@ -354,30 +361,36 @@ If an application calls this method to retrieve raw data which it saved into the
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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");
    +}
    +
    @@ -405,14 +418,16 @@ If an application calls this method to retrieve raw data which it saved into the
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -475,41 +490,53 @@ UnknownError - If the method cannot be completed because of an unknown error.
    -

    Code example:

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

    Code example:

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

    Code example:

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

    Code example:

    +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");
    +   }
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/mediacontroller.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/mediacontroller.html index a252609..c5764e7 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/mediacontroller.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/mediacontroller.html @@ -279,12 +279,16 @@ There is a tizen.mediacontroller object that allows access to the Media
    -

    Code example:

     try {
    -     var mcClient = tizen.mediacontroller.getClient();
    - } catch (err) {
    -     console.log (err.name +': ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var mcClient = tizen.mediacontroller.getClient();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ': ' + err.message);
    +}
    +
    @@ -329,12 +333,16 @@ and is controlled by Client.
    -

    Code example:

     try {
    -     var mcServer = tizen.mediacontroller.createServer();
    - } catch (err) {
    -     console.log (err.name +': ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var mcServer = tizen.mediacontroller.createServer();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ': ' + err.message);
    +}
    +
    @@ -434,11 +442,12 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +var mcServer = tizen.mediacontroller.createServer();
     
    - mcServer.updatePlaybackState('PLAY');
    - console.log('Current playback state is: ' + mcServer.playbackInfo.state);
    - 
    +mcServer.updatePlaybackState('PLAY'); +console.log('Current playback state is: ' + mcServer.playbackInfo.state); +
    @@ -476,11 +485,12 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +var mcServer = tizen.mediacontroller.createServer();
     
    - mcServer.updatePlaybackPosition(164);
    - console.log('Current playback position is: ' + mcServer.playbackInfo.position);
    - 
    +mcServer.updatePlaybackPosition(164); +console.log('Current playback position is: ' + mcServer.playbackInfo.position); +
    @@ -513,11 +523,12 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +var mcServer = tizen.mediacontroller.createServer();
     
    - mcServer.updateShuffleMode(true);
    - console.log('Current shuffle mode is: ' + mcServer.playbackInfo.shuffleMode);
    - 
    +mcServer.updateShuffleMode(true); +console.log('Current shuffle mode is: ' + mcServer.playbackInfo.shuffleMode); +
    @@ -550,11 +561,12 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +var mcServer = tizen.mediacontroller.createServer();
     
    - mcServer.updateRepeatMode(true);
    - console.log('Current repeat mode is: ' + mcServer.playbackInfo.repeatMode);
    - 
    +mcServer.updateRepeatMode(true); +console.log('Current repeat mode is: ' + mcServer.playbackInfo.repeatMode); +
    @@ -592,14 +604,15 @@ how to receive playback info changes from server on client side.
    -

    Code example:

     var mcServer = tizen.mediacontroller.createServer();
    - var metadata = mcServer.playbackInfo.metadata;
    +

    Code example:

    +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));
    - 
    +console.log('Current metadata is: ' + JSON.stringify(mcServer.playbackInfo.metadata)); +
    @@ -643,27 +656,33 @@ requests from client.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -696,30 +715,36 @@ requests from client.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -762,23 +787,23 @@ See MediaControllerServerInfo to check how to send custom commands from
    -

    Code example:

     var watcherId = 0; // watcher identifier
    - var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +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); +
    @@ -811,26 +836,26 @@ See MediaControllerServerInfo to check how to send custom commands from
    -

    Code example:

     var watcherId = 0; // watcher identifier
    - var mcServer = tizen.mediacontroller.createServer();
    +

    Code example:

    +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);
    - 
    +/* Cancels the watch operation */ +mcServer.removeCommandListener(watcherId); +
    @@ -922,12 +947,13 @@ Functions include operations to get the latest status of the media controller se
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -1058,15 +1084,18 @@ Provides methods to send commands to server and listen for server status change.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1115,15 +1144,18 @@ Provides methods to send commands to server and listen for server status change.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1169,15 +1201,18 @@ Provides methods to send commands to server and listen for server status change.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1223,15 +1258,18 @@ Provides methods to send commands to server and listen for server status change.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1285,18 +1323,20 @@ and respond to custom commands.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1338,15 +1378,17 @@ and respond to custom commands.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -1379,18 +1421,20 @@ and respond to custom commands.
    -

    Code example:

     var watcherId = 0; // watcher identifier
    - var mcClient = tizen.mediacontroller.getClient();
    - var mcServerInfo = mcClient.getLatestServerInfo();
    +

    Code example:

    +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);
    - 
    +/* Cancels the watch operation */ +mcServerInfo.removeServerStatusChangeListener(watcherId); +
    @@ -1432,29 +1476,35 @@ and respond to custom commands.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1487,33 +1537,39 @@ and respond to custom commands.
    -

    Code example:

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

    Code example:

    +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);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/mediakey.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/mediakey.html index 64dfd16..df8f7a6 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/mediakey.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/mediakey.html @@ -184,15 +184,19 @@ There is a tizen.mediakey object that allows accessing the functionality of the
    -

    Code example:

     tizen.mediakey.setMediaKeyEventListener({
    -     onpressed: function(key) {
    -         console.log("Pressed  key: " + key);
    -     },
    -     onreleased: function(key) {
    -         console.log("Released key: " + key);
    -     }
    - });
    - 
    +

    Code example:

    +tizen.mediakey.setMediaKeyEventListener(
    +{
    +   onpressed: function(key)
    +   {
    +      console.log("Pressed key: " + key);
    +   },
    +   onreleased: function(key)
    +   {
    +      console.log("Released key: " + key);
    +   }
    +});
    +
    @@ -216,8 +220,9 @@ There is a tizen.mediakey object that allows accessing the functionality of the
    -

    Code example:

     tizen.mediakey.unsetMediaKeyEventListener();
    - 
    +

    Code example:

    +tizen.mediakey.unsetMediaKeyEventListener();
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/messageport.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/messageport.html index c5bcd1e..8b93b6f 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/messageport.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/messageport.html @@ -240,9 +240,10 @@ The tizen.messageport object allows access to the functionality of the
    -

    Code example:

     // Requests the LocalMessagePort instance with the specified message port name
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - 
    +

    Code example:

    +/* Requests the LocalMessagePort instance with the specified message port name */
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +
    @@ -292,9 +293,10 @@ Trusted local message port can communicate with applications that are signed wit
    -

    Code example:

     // Requests the LocalMessagePort instance with the specified message port name
    - var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
    - 
    +

    Code example:

    +/* Requests the LocalMessagePort instance with the specified message port name */
    +var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
    +
    @@ -351,9 +353,10 @@ If the message port name and application ID are the same, the platform returns t
    -

    Code example:

     // Requests the RemoteMessagePort instance with the specified message port name
    - var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
    - 
    +

    Code example:

    +/* Requests the RemoteMessagePort instance with the specified message port name */
    +var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
    +
    @@ -414,9 +417,10 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     // Requests the RemoteMessagePort instance with the specified message port name.
    - var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
    - 
    +

    Code example:

    +/* Requests the RemoteMessagePort instance with the specified message port name */
    +var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
    +
    @@ -511,13 +515,15 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     function onreceived(data, remoteMsgPort) {
    -   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    - }
    +

    Code example:

    +function onreceived(data, remoteMsgPort)
    +{
    +   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    +}
     
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - 
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA'); +var watchId = localMsgPort.addMessagePortListener(onreceived); +
    @@ -561,11 +567,13 @@ Trusted remote message port can communicate with applications that are signed wi
    -

    Code example:

     var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - // Communication routines of your app...
    - localMsgPort.removeMessagePortListener(watchId);
    - 
    +

    Code example:

    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +var watchId = localMsgPort.addMessagePortListener(onreceived);
    +/* Communication routines of your app */
    +
    +localMsgPort.removeMessagePortListener(watchId);
    +
    @@ -679,30 +687,34 @@ array must not be duplicated or empty.
    -

    Code example:

     // 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);
    - 
    +

    Code example:

    +/* 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);
    +
    @@ -778,14 +790,16 @@ array must not be duplicated or empty.
    -

    Code example:

     // MessagePortCallback instance
    - function onreceived(data, remoteMsgPort) {
    -   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    - }
    -
    - var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    - var watchId = localMsgPort.addMessagePortListener(onreceived);
    - 
    +

    Code example:

    +/* MessagePortCallback instance */
    +function onreceived(data, remoteMsgPort)
    +{
    +   console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
    +}
    +
    +var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
    +var watchId = localMsgPort.addMessagePortListener(onreceived);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/nfc.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/nfc.html index f15498d..4f08720 100755 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/nfc.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/nfc.html @@ -559,12 +559,16 @@ It provides access to the API functionalities through the tizen.nfc interface.
    -

    Code example:

     try {
    -     var adapter = tizen.nfc.getDefaultAdapter();
    - } catch (err) {
    -     console.log(err.name +": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var adapter = tizen.nfc.getDefaultAdapter();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -624,12 +628,16 @@ The exclusive mode can only be set when NFC is on. If NFC is off, the mode is ig
    -

    Code example:

     try {
    -   tizen.nfc.setExclusiveMode(true) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.nfc.setExclusiveMode(true);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -892,33 +900,43 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -990,14 +1008,21 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1062,14 +1087,21 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1115,24 +1147,28 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    - 
    +/* Registers to be notified when NFC tag is detected */ +adapter.setTagListener(onSuccessCB); +
    @@ -1178,24 +1214,28 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    - 
    +/* Registers to be notified when NFC peer target is detected */ +adapter.setPeerListener(onSuccessCB); +
    @@ -1251,15 +1291,20 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1308,12 +1353,16 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     try {
    -   adapter.removeCardEmulationModeChangeListener(listenerId) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.removeCardEmulationModeChangeListener(listenerId);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1374,12 +1423,16 @@ Such an event may indicate initiating a financial transaction using the device.
    -

    Code example:

     try {
    -   var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data){console.log("transaction event occurs");}) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data) {console.log("transaction event occurs");});
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1428,12 +1481,16 @@ Such an event may indicate initiating a financial transaction using the device.
    -

    Code example:

     try {
    -   adapter.removeTransactionEventListener(listenerId) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.removeTransactionEventListener(listenerId);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1489,15 +1546,20 @@ Such an event may indicate initiating a financial transaction using the device.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1546,12 +1608,16 @@ Such an event may indicate initiating a financial transaction using the device.
    -

    Code example:

     try {
    -   adapter.removeActiveSecureElementChangeListener(listenerId) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.removeActiveSecureElementChangeListener(listenerId);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1598,9 +1664,10 @@ should be returned.
    -

    Code example:

     // Gets the cached message
    - var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
    - 
    +

    Code example:

    +/* Gets the cached message */
    +var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
    +
    @@ -1665,12 +1732,16 @@ Losing priority is always allowed regardless of an application's status.
    -

    Code example:

     try {
    -   adapter.setExclusiveModeForTransaction(true) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.setExclusiveModeForTransaction(true);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1730,16 +1801,21 @@ Losing priority is always allowed regardless of an application's status.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1788,12 +1864,16 @@ Losing priority is always allowed regardless of an application's status.
    -

    Code example:

     try {
    -   adapter.removeHCEEventListener(listenerId) ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   adapter.removeHCEEventListener(listenerId);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1865,21 +1945,27 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -1943,16 +2029,21 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2016,15 +2107,20 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -2088,14 +2184,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     try {
    -
    -   var aid = "ABC0012345";
    -   adapter.registerAID("HCE", aid, "PAYMENT") ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var aid = "ABC0012345";
    +   adapter.registerAID("HCE", aid, "PAYMENT");
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -2159,14 +2258,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     try {
    -
    -   var aid = "ABC0012345";
    -   adapter.unregisterAID("HCE", aid, "PAYMENT") ;
    - } catch (err) {
    -   console.log(err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var aid = "ABC0012345";
    +   adapter.unregisterAID("HCE", aid, "PAYMENT");
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -2326,18 +2428,25 @@ The array's index is the pair's key and value is its value. 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +
  • @@ -2644,21 +2753,28 @@ is not compatible with the expected type for that parameter.
  • -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2698,21 +2814,27 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -2874,10 +2996,11 @@ If the operation completes successfully, it returns the serial byte array of the
    -

    Code example:

     // Gets the cached message.
    - var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
    - var raw = cachedMessage.toByte();
    - 
    +

    Code example:

    +/* Gets the cached message */
    +var cachedMessage = tizen.nfc.getDefaultAdapter().getCachedMessage();
    +var raw = cachedMessage.toByte();
    +
    @@ -2995,10 +3118,11 @@ The byte array contains 0 to (2 ** 32 - 1) bytes. 2.3.1

    -

    Code example:

     // Creates a new NDEF record.
    - var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
    - var payload = newRecord.payload;
    - 
    +

    Code example:

    +/* Creates a new NDEF record */
    +var newRecord = new tizen.NDEFRecordURI("https://www.tizen.org/");
    +var payload = newRecord.payload;
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/notification.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/notification.html index a42fbf2..949317b 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/notification.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/notification.html @@ -281,27 +281,29 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -354,14 +356,18 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -413,13 +419,17 @@ parameters contain an invalid value.
    -

    Code example:

     try {
    -      // Uses a variable for the previously posted notification.
    -      tizen.notification.remove(notification.id);
    - } catch (err) {
    -      console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   /* Uses a variable for the previously posted notification */
    +   tizen.notification.remove(notification.id);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -456,12 +466,16 @@ parameters contain an invalid value.
    -

    Code example:

     try {
    -      tizen.notification.removeAll();
    - } catch (err) {
    -      console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.notification.removeAll();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -498,16 +512,20 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -530,27 +548,31 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -783,24 +805,29 @@ This method has effects when the device has notification LED. 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
  • @@ -882,26 +909,30 @@ The maximum number of thumbnail path elements in the array is 4. 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
  • @@ -937,35 +968,35 @@ Range of progressValue: percent (0 to 100). 2.3.1

    -

    Code example:

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

    Code example:

    +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);
    +}
    +
  • @@ -987,8 +1018,9 @@ Range of progressValue: percent (0 to 100). 2.3.1

    -

    Code example:

     var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013');
    - notification.detailInfo = [detailInfo1];
    +

    Code example:

    +var detailInfo1 = new tizen.NotificationDetailInfo('Missed Call from James', 'Feb 11 2013');
    +notification.detailInfo = [detailInfo1];
     
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/package.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/package.html index a115b55..9c0f8ae 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/package.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/package.html @@ -225,31 +225,34 @@ UnknownError - If it is not allowed to install the package by the platform or an
    -

    Code example:

     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");
    -
    - 
    +

    Code example:

    +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");
    +
    @@ -320,22 +323,27 @@ UnknownError - If it is not allowed to uninstall the package from the platform o
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -397,16 +405,20 @@ UnknownError - If any other platform error occurs.
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
    @@ -468,10 +480,11 @@ The list of installed packages and their package IDs is obtained using getPa
    -

    Code example:

     var packageInfo = tizen.package.getPackageInfo(null);
    +

    Code example:

    +var packageInfo = tizen.package.getPackageInfo(null);
     
    - console.log("Current Package ID : " + packageInfo.id);
    - 
    +console.log("Current Package ID: " + packageInfo.id); +
    @@ -528,20 +541,25 @@ The callback lasts until the unsetPackageInfoEventListener() method is
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -578,8 +596,9 @@ The callback lasts until the unsetPackageInfoEventListener() method is
    -

    Code example:

     tizen.package.unsetPackageInfoEventListener();
    - 
    +

    Code example:

    +tizen.package.unsetPackageInfoEventListener();
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/power.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/power.html index 3f545d0..8bfe03c 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/power.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/power.html @@ -283,8 +283,9 @@ parameters contain an invalid value.
    -

    Code example:

     tizen.power.request("SCREEN", "SCREEN_NORMAL");
    - 
    +

    Code example:

    +tizen.power.request("SCREEN", "SCREEN_NORMAL");
    +
    @@ -330,9 +331,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Release SCREEN resource.
    - tizen.power.release("SCREEN");
    - 
    +

    Code example:

    +/* Release SCREEN resource */
    +tizen.power.release("SCREEN");
    +
    @@ -378,13 +380,15 @@ parameters contain an invalid value.
    -

    Code example:

     function onScreenStateChanged(previousState, changedState) {
    -   console.log("Screen state changed from " + previousState + " to " + changedState);
    - }
    +

    Code example:

    +function onScreenStateChanged(previousState, changedState)
    +{
    +   console.log("Screen state changed from " + previousState + " to " + changedState);
    +}
     
    - // Sets the screen state change listener.
    - tizen.power.setScreenStateChangeListener(onScreenStateChanged);
    - 
    +/* Sets the screen state change listener */ +tizen.power.setScreenStateChangeListener(onScreenStateChanged); +
    @@ -413,9 +417,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Unsets the screen state change listener.
    - tizen.power.unsetScreenStateChangeListener();
    - 
    +

    Code example:

    +/* Unsets the screen state change listener */
    +tizen.power.unsetScreenStateChangeListener();
    +
    @@ -448,9 +453,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Gets the current screen brightness value.
    - var screenBrightness = tizen.power.getScreenBrightness();
    - 
    +

    Code example:

    +/* Gets the current screen brightness value */
    +var screenBrightness = tizen.power.getScreenBrightness();
    +
    @@ -512,9 +518,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Sets the screen brightness value for the application.
    - tizen.power.setScreenBrightness(1);
    - 
    +

    Code example:

    +/* Sets the screen brightness value for the application */
    +tizen.power.setScreenBrightness(1);
    +
    @@ -547,9 +554,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Checks whether the screen is on or off.
    - var isScreenOn = tizen.power.isScreenOn();
    - 
    +

    Code example:

    +/* Checks whether the screen is on or off */
    +var isScreenOn = tizen.power.isScreenOn();
    +
    @@ -578,9 +586,10 @@ parameters contain an invalid value.
    -

    Code example:

     // Restores the screen brightness value to the system default setting value.
    - tizen.power.restoreScreenBrightness();
    - 
    +

    Code example:

    +/* Restores the screen brightness value to the system default setting value */
    +tizen.power.restoreScreenBrightness();
    +
    @@ -628,9 +637,10 @@ This API triggers turn-on process and then updates the status when it completes.
    -

    Code example:

     // Turns the screen on.
    - tizen.power.turnScreenOn();
    - 
    +

    Code example:

    +/* Turns the screen on */
    +tizen.power.turnScreenOn();
    +
    @@ -679,9 +689,10 @@ While the operation is on-going, the isScreenOn() method returns true.
    -

    Code example:

     // Turns the screen off.
    - tizen.power.turnScreenOff();
    - 
    +

    Code example:

    +/* Turns the screen off */
    +tizen.power.turnScreenOff();
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/preference.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/preference.html index 05a03ae..9b169a8 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/preference.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/preference.html @@ -211,14 +211,17 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     var successCB = function(preferences) {
    -   if (preferences.length) {
    -     console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
    -   }
    - };
    +

    Code example:

    +var successCB = function(preferences)
    +{
    +   if (preferences.length)
    +   {
    +      console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
    +   }
    +};
     
    - tizen.preference.getAll(successCB);
    - 
    +tizen.preference.getAll(successCB); +

    Output example:

     The first preference - key: key1 value: Sample value
    @@ -264,8 +267,9 @@ The tizen.preference object provides access to the Preference service A
     
             
    -

    Code example:

     tizen.preference.setValue('key1', 'New value');
    - 
    +

    Code example:

    +tizen.preference.setValue('key1', 'New value');
    +
    @@ -310,9 +314,10 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     var currentValue = tizen.preference.getValue('key1');
    - console.log('The current value of the preference key1 is: ' + currentValue);
    - 
    +

    Code example:

    +var currentValue = tizen.preference.getValue('key1');
    +console.log('The current value of the preference key1 is: ' + currentValue);
    +

    Output example:

     The current value of the preference key1 is: New value
    @@ -357,8 +362,9 @@ The tizen.preference object provides access to the Preference service A
     
             
    -

    Code example:

     tizen.preference.remove('key1');
    - 
    +

    Code example:

    +tizen.preference.remove('key1');
    +
    @@ -387,8 +393,9 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     tizen.preference.removeAll();
    - 
    +

    Code example:

    +tizen.preference.removeAll();
    +
    @@ -430,12 +437,16 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     if (tizen.preference.exists('key1')) {
    -   console.log('Preference with the key key1 exists');
    - } else {
    -   console.log('Preference with the key key1 doesn't exist');
    - }
    - 
    +

    Code example:

    +if (tizen.preference.exists('key1'))
    +{
    +   console.log('Preference with the key key1 exists');
    +}
    +else
    +{
    +   console.log('Preference with the key key1 doesn't exist');
    +}
    +

    Output example:

     Preference with the key key1 exists
    @@ -487,12 +498,14 @@ The tizen.preference object provides access to the Preference service A
     
             
    -

    Code example:

     var listener = function(data) {
    -   console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
    - };
    +

    Code example:

    +var listener = function(data)
    +{
    +   console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
    +};
     
    - tizen.preference.setChangeListener('key1', listener);
    - 
    +tizen.preference.setChangeListener('key1', listener); +

    Output example:

     Preference with the key: key1 has a new value: Sample value
    @@ -537,12 +550,14 @@ The tizen.preference object provides access to the Preference service A
     
             
    -

    Code example:

     var listener = function(data) {
    -   tizen.preference.unsetChangeListener(data.key);
    - };
    +

    Code example:

    +var listener = function(data)
    +{
    +   tizen.preference.unsetChangeListener(data.key);
    +};
     
    - tizen.preference.setChangeListener('key1', listener);
    - 
    +tizen.preference.setChangeListener('key1', listener); +
    @@ -586,12 +601,14 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     var listener = function(data) {
    -   tizen.preference.unsetChangeListener(data.key);
    - };
    +

    Code example:

    +var listener = function(data)
    +{
    +   tizen.preference.unsetChangeListener(data.key);
    +};
     
    - tizen.preference.setChangeListener('key1', listener);
    - 
    +tizen.preference.setChangeListener('key1', listener); +
    @@ -635,14 +652,17 @@ The tizen.preference object provides access to the Preference service A
    -

    Code example:

     var successCB = function(preferences) {
    -   if (preferences.length) {
    -     console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
    -   }
    - };
    +

    Code example:

    +var successCB = function(preferences)
    +{
    +   if (preferences.length)
    +   {
    +      console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
    +   }
    +};
     
    - tizen.preference.getAll(successCB);
    - 
    +tizen.preference.getAll(successCB); +

    Output example:

     First preference - key: key1 value: Sample value
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/push.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/push.html
    index 7732c3c..26aecfe 100755
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/push.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/push.html
    @@ -256,22 +256,25 @@ do not contain a valid value.
     
             
    -

    Code example:

     // 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");
    +

    Code example:

    +/* 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);
    - 
    +/* Requests registration */ +tizen.push.registerService(service, registerSuccessCallback, errorCallback); +
    @@ -330,19 +333,22 @@ AbortError - If the operation cannot be finished properly.
    -

    Code example:

     // Defines the error callback.
    - function errorCallback(response) {
    -   console.log("The following error occurred: " +  response.name);
    - }
    +

    Code example:

    +/* 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);
    - 
    +/* Requests application registration */ +tizen.push.register(registerSuccessCallback, errorCallback); +

    Output example:

     Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
    @@ -414,19 +420,22 @@ UnknownError - If an unknown error occurs.              
     
             
    -

    Code example:

     // Defines the error callback
    - function errorCallback(response) {
    -   console.log( 'The following error occurred: ' +  response.name);
    - }
    +

    Code example:

    +/* 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);
    - 
    +/* Requests unregistration */ +tizen.push.unregisterService(unregisterSuccessCallback, errorCallback); +
    @@ -485,19 +494,22 @@ AbortError - If the operation cannot be finished properly.
    -

    Code example:

     // Defines the error callback
    - function errorCallback(response) {
    -   console.log("The following error occurred: " +  response.name);
    - }
    +

    Code example:

    +/* 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);
    - 
    +/* Requests unregistration */ +tizen.push.unregister(unregisterSuccessCallback, errorCallback); +

    Output example:

     Unregistration succeeded.
    @@ -557,27 +569,31 @@ the register() method must be called before calling the connectServ
     
             
    -

    Code example:

     // Defines the registration error callback.
    - function errorCallback(response) {
    -   console.log("The following error occurred: " +  response.name);
    - }
    +

    Code example:

    +/* 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);
    - 
    +/* Requests for push service connection */ +tizen.push.connectService(notificationCallback); +
    @@ -614,9 +630,10 @@ the register() method must be called before calling the connectServ
    -

    Code example:

     // Requests disconnection
    - tizen.push.disconnectService();
    - 
    +

    Code example:

    +/* Requests disconnection */
    +tizen.push.disconnectService();
    +
    @@ -657,11 +674,13 @@ the register() method must be called before calling the connectServ
    -

    Code example:

     var registrationId = tizen.push.getRegistrationId();
    - if ( registrationId != null ) {
    -   console.log("The registration id: " + registrationId);
    - }
    - 
    +

    Code example:

    +var registrationId = tizen.push.getRegistrationId();
    +if (registrationId != null)
    +{
    +   console.log("The registration id: " + registrationId);
    +}
    +
    @@ -715,16 +734,17 @@ Once a missed push notification is retrieved the server deletes it from its data
    -

    Code example:

     // Defines the connect success callback
    - function notificationCallback(message) {
    -     console.log("New push message : " + message.alertMessage + ", date : " + message.date + ", data : " + message.appData);
    -   }
    - }
    +

    Code example:

    +/* 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();
    - 
    +/* Requests for push service connection */ +tizen.push.connectService(notificationCallback); +tizen.push.getUnreadNotifications(); +
    @@ -775,13 +795,17 @@ If the application was not launched by the push service, this method returns
    -

    Code example:

     try {
    -   var message = tizen.push.getPushMessage();
    -   console.log('Message received from: ' + message.sender);
    - } catch (err) {
    -   console.log('Exception - code: ' + err.name + ' message: ' + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   var message = tizen.push.getPushMessage();
    +   console.log('Message received from: ' + message.sender);
    +}
    +catch (err)
    +{
    +   console.log('Exception - code: ' + err.name + ' message: ' + err.message);
    +}
    +

    Output example:

     Message received from: xyz.AnotherApp
    @@ -905,21 +929,23 @@ This data is the message that the sender wants to send and its length must be le
      3.0
                 

    -

    Code example:

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

    Code example:

    +/* 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);
    - 
    +/* Requests for push service connection */ +tizen.push.connectService(notificationCallback); +

    Output example:

     Notification received on Thu Jan 01 2015 from: xyz.AnotherApp
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/se.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/se.html
    index b73a15f..b774387 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/se.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/se.html
    @@ -225,22 +225,30 @@ The ErrorCallback is launched with these error types:
     
             
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -293,24 +301,32 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    - }
    - 
    +try +{ +   var seListener = tizen.seService.registerSEListener(listener); +} +catch (err) +{ +   console.log(err.name + ": " + err.message); +} +
    @@ -356,13 +372,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     var seListener; //seListener obtained from registerSEListener
    - try {
    -  tizen.seService.unregisterSEListener(seListener);
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var seListener; /* seListener obtained from registerSEListener */
    +try
    +{
    +   tizen.seService.unregisterSEListener(seListener);
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -399,12 +419,16 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     try {
    -  tizen.seService.shutdown();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   tizen.seService.shutdown();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -485,22 +509,30 @@ This interface offers methods to control sessions on the reader.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -563,18 +595,24 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -611,12 +649,16 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     try {
    -  reader.closeSessions();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +try
    +{
    +   reader.closeSessions();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -736,31 +778,42 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    - }
    - 
    +   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); +} +
    @@ -840,25 +893,34 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    - }
    - 
    +   /* 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); +} +
    @@ -899,13 +961,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     var session; //Session obtained from openSession callback
    - try {
    -  var atr = session.getATR();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var session; /* Session obtained from openSession callback */
    +try
    +{
    +   var atr = session.getATR();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -942,13 +1008,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     var session; //Session obtained from openSession callback
    - try {
    -  session.close();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var session; /* Session obtained from openSession callback */
    +try
    +{
    +   session.close();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -985,13 +1055,17 @@ The ErrorCallback is launched with these error types:
    -

    Code example:

     var session; //Session obtained from openSession callback
    - try {
    -  session.closeChannels();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var session; /* Session obtained from openSession callback */
    +try
    +{
    +   session.closeChannels();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    @@ -1065,13 +1139,17 @@ The channel is defined in the ISO7816-4.
    -

    Code example:

     var channel; //Obtained from openLogicalChannel or openBasicChannel
    - try {
    -  channel.close();
    - } catch (err) {
    -  console.log (err.name + ": " + err.message);
    - }
    - 
    +

    Code example:

    +var channel; /* Obtained from openLogicalChannel or openBasicChannel */
    +try
    +{
    +   channel.close();
    +}
    +catch (err)
    +{
    +   console.log(err.name + ": " + err.message);
    +}
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html index 3a269ef..8dfe9cf 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html @@ -421,16 +421,20 @@ The supported sensor types are hardware-dependent.

    To check if the given
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -458,10 +462,11 @@ The supported sensor types are hardware-dependent.

    To check if the given
    -

    Code example:

     var sensorCapabilities = tizen.sensorservice.getAvailableSensors();
    +

    Code example:

    +var sensorCapabilities = tizen.sensorservice.getAvailableSensors();
     
    - console.log("capable sensor : " + sensorCapabilities[0]);
    - 
    +console.log("capable sensor: " + sensorCapabilities[0]); +
    @@ -546,14 +551,16 @@ The supported sensor types are hardware-dependent.

    To check if the given
    -

    Code example:

     var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    +

    Code example:

    +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);
    - 
    +proximitySensor.start(onsuccessCB); +
    @@ -577,15 +584,17 @@ The supported sensor types are hardware-dependent.

    To check if the given
    -

    Code example:

     var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    +

    Code example:

    +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);
    - 
    +proximitySensor.start(onsuccessCB); +
    @@ -649,21 +658,24 @@ The start() method must be called to turn on the sensor, or the sensor data will
    -

    Code example:

     var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
    +

    Code example:

    +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);
    - 
    +lightSensor.start(onsuccessCB); +
    @@ -687,16 +699,18 @@ The start() method must be called to turn on the sensor, or the sensor data will
    -

    Code example:

     var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    +

    Code example:

    +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();
    - 
    +proximitySensor.unsetChangeListener(); +
    @@ -744,20 +758,22 @@ IOError - If the platform fails to internally prepare a socket for IPC communica
    -

    Code example:

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

    Code example:

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

    Output example:

      name: Gravity Sensor
    @@ -840,24 +856,27 @@ The ErrorCallback method is launched with these error types:
     
             
    -

    Code example:

     var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
    -
    - function onGetSuccessCB(sensorData) {
    -     console.log("light level : " + sensorData.lightLevel);
    - }
    +

    Code example:

    +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);
    +}
     
    - 
    +lightSensor.start(onsuccessCB); +
    @@ -929,26 +948,29 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1020,24 +1042,27 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

     var pressureSensor = tizen.sensorservice.getDefaultSensor("PRESSURE");
    +

    Code example:

    +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);
    -
    - 
    +pressureSensor.start(onsuccessCB); +
    @@ -1109,24 +1134,27 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

     var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
    -
    - function onGetSuccessCB(sensorData) {
    -     console.log("proximity state : " + sensorData.proximityState);
    - }
    +

    Code example:

    +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);
    +}
     
    - 
    +proximitySensor.start(onsuccessCB); +
    @@ -1198,24 +1226,27 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

     var ultravioletSensor = tizen.sensorservice.getDefaultSensor("ULTRAVIOLET");
    -
    - function onGetSuccessCB(sensorData) {
    -     console.log("ultraviolet level : " + sensorData.ultravioletLevel);
    - }
    +

    Code example:

    +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);
    +}
     
    - 
    +ultravioletSensor.start(onsuccessCB); +
    @@ -1303,24 +1334,27 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

     var HRMrawsensor = tizen.sensorservice.getDefaultSensor("HRM_RAW");
    -
    - function onGetSuccessCB(sensorData) {
    -     console.log("HRMRaw light intensity : " + sensorData.lightIntensity);
    - }
    +

    Code example:

    +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);
    +}
     
    - 
    +HRMrawsensor.start(onsuccessCB); +
    @@ -1392,26 +1426,30 @@ The ErrorCallback method is launched with these error types:
    -

    Code example:

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

    Code example:

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

    Output example:

     sensor start
    @@ -1491,26 +1529,30 @@ The ErrorCallback method is launched with these error types:
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     sensor start
    @@ -1590,27 +1632,31 @@ The ErrorCallback method is launched with these error types:
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     sensor start
    @@ -1691,26 +1737,30 @@ The ErrorCallback method is launched with these error types:
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     linear acceleration sensor start
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/sound.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/sound.html
    index 81c99a4..2397219 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/sound.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/sound.html
    @@ -551,12 +551,14 @@ There is a tizen.sound object that allows accessing the functionality of the Sou
     
             
    -

    Code example:

     var infoArr = tizen.sound.getConnectedDeviceList();
    +

    Code example:

    +var infoArr = tizen.sound.getConnectedDeviceList();
     
    - for (var i = 0; i < infoArr.length; i++) {
    -     cosole.log( infoArr[i].device );
    - }
    - 
    +for (var i = 0; i < infoArr.length; i++) +{ +   console.log(infoArr[i].device); +} +
    @@ -584,12 +586,14 @@ There is a tizen.sound object that allows accessing the functionality of the Sou
    -

    Code example:

     var infoArr = tizen.sound.getActivatedDeviceList();
    +

    Code example:

    +var infoArr = tizen.sound.getActivatedDeviceList();
     
    - for (var i = 0; i < infoArr.length; i++) {
    -     cosole.log( infoArr[i].device );
    - }
    - 
    +for (var i = 0; i < infoArr.length; i++) +{ +   console.log(infoArr[i].device); +} +
    @@ -642,28 +646,36 @@ Activation: When a device chages from being activated to being deactivated or fr
    -

    Code example:

     // 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" );
    -     }
    +

    Code example:

    +/* 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);
    - 
    +var id = tizen.sound.addDeviceStateChangeListener(onChanged); +
    @@ -696,9 +708,10 @@ Activation: When a device chages from being activated to being deactivated or fr
    -

    Code example:

     // If a listener to be called was registered previously.
    - tizen.sound.removeDeviceStateChangeListener(id);
    - 
    +

    Code example:

    +/* If a listener to be called was registered previously */
    +tizen.sound.removeDeviceStateChangeListener(id);
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/systeminfo.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/systeminfo.html index b8fbd04..d23049e 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/systeminfo.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/systeminfo.html @@ -517,9 +517,10 @@ and for subscribing notifications of system information changes.
    -

    Code example:

     // To get total amount of system memory
    - console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
    - 
    +

    Code example:

    +/* To get total amount of system memory */
    +console.log("The total memory size is " + tizen.systeminfo.getTotalMemory() + " bytes.");
    +
    @@ -543,9 +544,10 @@ and for subscribing notifications of system information changes.
    -

    Code example:

     // To get total amount of system memory
    - console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
    - 
    +

    Code example:

    +/* To get total amount of system memory */
    +console.log("The available memory size is " + tizen.systeminfo.getAvailableMemory() + " bytes.");
    +
    @@ -577,12 +579,14 @@ The function must synchronously acquire the capabilities of the device.
    -

    Code example:

     var deviceCapabilities;
    - deviceCapabilities = tizen.systeminfo.getCapabilities();
    - if (deviceCapabilities.bluetooth) {
    -     console.log("Bluetooth is supported");
    - }
    - 
    +

    Code example:

    +var deviceCapabilities;
    +deviceCapabilities = tizen.systeminfo.getCapabilities();
    +if (deviceCapabilities.bluetooth)
    +{
    +   console.log("Bluetooth is supported");
    +}
    +
    @@ -625,14 +629,18 @@ The additional keys for the custom device capability are specified by OEM's and
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -674,13 +682,17 @@ That is the length of array retrieved by the getPropertyValueArray() method for
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -759,36 +771,45 @@ NotSupportedError - If the given property is not supported. (since Ti
    -

    Code example:

     function onSuccessCallback(cpu) {
    -     console.log("The cpu load is " + cpu.load);
    - }
    +

    Code example:

    +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);
    - 
    +tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback); +
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -863,26 +884,35 @@ NotSupportedError - If the given property is not supported.
    -

    Code example:

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

    Code example:

    +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);
    +}
    +
    @@ -986,12 +1016,14 @@ NotSupportedError - If the given property is not supported. (since Ti
    -

    Code example:

     function onSuccessCallback(cpu) {
    -     console.log("The cpu load : " + cpu.load);
    - }
    +

    Code example:

    +function onSuccessCallback(cpu)
    +{
    +   console.log("The cpu load: " + cpu.load);
    +}
     
    - tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold : 0.2});
    - 
    +tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2}); +
    @@ -1124,16 +1156,20 @@ parameters contain an invalid value.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -3399,15 +3435,15 @@ identify a mobile phone operator/carrier using the GSM, CDMA, iDEN, TETRA and UM
    -

    Code example:

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

    Code example:

    +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);
    +});
    +
  • @@ -3518,19 +3554,22 @@ If the specified brightness value is not supported by the device, the brightness
  • -

    Code example:

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

    Code example:

    +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);
    +});
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/systemsetting.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/systemsetting.html index 1bfe50c..2468ba8 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/systemsetting.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/systemsetting.html @@ -238,37 +238,45 @@ UnknownError - If any other error occurs
    -

    Code example:

     // Checks whether SystemSetting API is supported.
    - var systemsetting_api_supported = tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting");
    +

    Code example:

    +/* 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.");
    - }
    -
    - 
    +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."); +} +
    @@ -337,21 +345,23 @@ UnknownError - If any other error occurs
    -

    Code example:

     // 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.
    - }
    +

    Code example:

    +/* 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 */
    +}
     
    - 
    +tizen.systemsetting.getProperty("HOME_SCREEN", getPropertySuccessCallback, errorCallback); +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/time.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/time.html index d69e785..e43b540 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/time.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/time.html @@ -273,9 +273,10 @@ Get timezones using getLocalTimezone() and getAvailableTimezones(). <
    -

    Code example:

     var current_dt = tizen.time.getCurrentDateTime();
    - console.log("current date/time is " + current_dt.toLocaleString());
    - 
    +

    Code example:

    +var current_dt = tizen.time.getCurrentDateTime();
    +console.log("current date/time is " + current_dt.toLocaleString());
    +
    @@ -303,8 +304,9 @@ Get timezones using getLocalTimezone() and getAvailableTimezones(). <
    -

    Code example:

     console.log("The local time zone is " + tizen.time.getLocalTimezone());
    - 
    +

    Code example:

    +console.log("The local time zone is " + tizen.time.getLocalTimezone());
    +
    @@ -339,9 +341,10 @@ with the most general descriptor first and the most specific one last. For examp
    -

    Code example:

     var tzids = tizen.time.getAvailableTimezones();
    - console.log("The device supports " + tzids.length + " time zones.");
    - 
    +

    Code example:

    +var tzids = tizen.time.getAvailableTimezones();
    +console.log("The device supports " + tzids.length + " time zones.");
    +
    @@ -486,12 +489,14 @@ parameters contain an invalid value.
    -

    Code example:

     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.");
    - }
    - 
    +

    Code example:

    +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.");
    +}
    +
    @@ -533,19 +538,22 @@ Listener set with setTimezoneChangeListener() method is called when dev
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -569,19 +577,23 @@ Listener set with setTimezoneChangeListener() method is called when dev
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -625,19 +637,23 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -661,18 +677,23 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

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

    Code example:

    +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);
    +
    @@ -1869,9 +1890,10 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     var now = tizen.time.getCurrentDateTime();
    - var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
    - 
    +

    Code example:

    +var now = tizen.time.getCurrentDateTime();
    +var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
    +
    @@ -2047,11 +2069,12 @@ savings if it is in the timezone. For example, if time zone is GMT+8, it will re
    -

    Code example:

     var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
    - var myDate = new Date();
    - var exp_offset = myDate.getTimezoneOffset()*60;
    - //offset is equals to exp_offset.
    - 
    +

    Code example:

    +var offset = tizen.time.getCurrentDateTime().secondsFromUTC();
    +var myDate = new Date();
    +var exp_offset = myDate.getTimezoneOffset() * 60;
    +/* offset is equal to exp_offset */
    +
    @@ -2163,9 +2186,10 @@ identified by the TZDate object. 1.0

    -

    Code example:

     var now = tizen.time.getCurrentDateTime();
    - var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); // Becomes tomorrow, same time.
    - 
    +

    Code example:

    +var now = tizen.time.getCurrentDateTime();
    +var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); /* Becomes tomorrow, same time */
    +

    Constructors

    @@ -2257,16 +2281,17 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     // 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.");
    - 
    +

    Code example:

    +/* 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.");
    +
    @@ -2315,10 +2340,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    @@ -2364,10 +2390,11 @@ This method takes the units into consideration when doing the comparison.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    @@ -2414,10 +2441,11 @@ is not compatible with the expected type for that parameter.
    -

    Code example:

     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
    - 
    +

    Code example:

    +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 */
    +
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/tizen.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/tizen.html index d27795e..6605d9d 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/tizen.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/tizen.html @@ -295,21 +295,24 @@ the specified value.

    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree".
    - var count = 100;
    - var offset = 0;
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    +

    Code example:

    +/* 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);
    - 
    +tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset); +
    @@ -398,25 +401,30 @@ Range filters, where only one boundary is set, are available.

    -

    Code example:

     var count = 100;
    - var offset = 0;
    - // Use the modifiedDate attribute with a range that starts today and ends in 1 day
    - // (meaning that you search for all contents modified today)
    - var today = new Date();
    - var today_begin = new Date(today.getFullYear(), today.getMonth(),today.getDate());
    - var today_end = new Date(today.getFullYear(), today.getMonth(),today.getDate()+1);
    - var dateRangeFilter = new tizen.AttributeRangeFilter("modifiedDate", today_begin, today_end);
    +

    Code example:

    +var count = 100;
    +var offset = 0;
    +/*
    +   Use the modifiedDate attribute with a range that starts today and ends in 1 day
    +   (meaning that you search for all contents modified today)
    +*/
    +var today = new Date();
    +var today_begin = new Date(today.getFullYear(), today.getMonth(), today.getDate());
    +var today_end = new Date(today.getFullYear(), today.getMonth(), today.getDate()+1);
    +var dateRangeFilter = new tizen.AttributeRangeFilter("modifiedDate", today_begin, today_end);
     
    - function errorCB(err) {
    -     console.log( 'The following error occurred: ' +  err.name);
    - }
    +function 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);
    - 
    +tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset); +
    @@ -504,23 +512,26 @@ The intersection - used to filter objects that match all the filters it includes
    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2".
    - var count = 100;
    - var offset = 0;
    - var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "U2");
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    - var filter = new tizen.CompositeFilter("INTERSECTION", [albumFilter, artistFilter]);
    +

    Code example:

    +/* 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);
    - 
    +tizen.content.find(findCB, errorCB, null, filter, null, count, offset); +
    @@ -573,34 +584,40 @@ Note that the sorting result of list type attributes is not determined.

    -

    Code example:

     // The following example retrieves all songs from the album "The Joshua Tree", by artist "U2", ordered by the track number.
    - var count = 100;
    - var offset = 0;
    - var sortMode = new tizen.SortMode("trackNumber", "ASC");
    - var artistFilter = new tizen.AttributeFilter("artists", "EXACTLY", "U2");
    - var albumFilter = new tizen.AttributeFilter("album", "EXACTLY", "The Joshua Tree");
    - var filter = new tizen.CompositeFilter("INTERSECTION", [albumFilter, artistFilter]);
    +

    Code example:

    +/* 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);
    - 
    +tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset); +

    Constructors

    @@ -1157,11 +1174,13 @@ In case of successful execution of an asynchronous call, SuccessCallback
    -

    Code example:

         function onSuccess() {
    -         console.log("Application launched successfully");
    -     }
    -     tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
    - 
    +

    Code example:

    +function onSuccess()
    +{
    +   console.log("Application launched successfully");
    +}
    +tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
    +

    Methods

    @@ -1204,16 +1223,20 @@ it silently fails and there is no further action.

    -

    Code example:

      // Define the error callback.
    -  function onerror(error) {
    -    console.log(error.message);
    -  }
    -  function onsuccess() {
    -      console.log("The application has launched successfully");
    -  }
    +

    Code example:

    +/* Define the error callback */
    +function onerror(error)
    +{
    +   console.log(error.message);
    +}
     
    -  tizen.application.launch("targetApp0.main", onsuccess, onerror);
    - 
    +function onsuccess() +{ +   console.log("The application has launched successfully"); +} + +tizen.application.launch("targetApp0.main", onsuccess, onerror); +

    Methods

    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/widgetservice.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/widgetservice.html index 3c74d81..4aaea7d 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/widgetservice.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/widgetservice.html @@ -428,19 +428,23 @@ The tizen.widgetservice object provides access to the Widget service AP
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Widget id is org.tizen.gallery.widget
    @@ -515,12 +519,15 @@ NotFoundError - If the device has no widgets or if a widget with the given id do
     
             
    -

    Code example:

     tizen.widgetservice.getWidgets(function (widgets) {
    -   console.log("There are " + widgets.length + " available widgets");
    - }, function (error) {
    -    console.log("Error: " + error.message);
    - });
    - 
    +

    Code example:

    +tizen.widgetservice.getWidgets(function(widgets)
    +{
    +   console.log("There are " + widgets.length + " available widgets");
    +}, function(error)
    +{
    +   console.log("Error: " + error.message);
    +});
    +

    Output example:

     There are 3 available widgets
    @@ -580,15 +587,19 @@ NotFoundError - If the device has no widgets or if a widget with the given id do
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Widget id is org.tizen.gallery.widget
    @@ -600,7 +611,7 @@ NotFoundError - If the device has no widgets or if a widget with the given id do
     
    - Returns the size coresponding to the given sizeType. + Returns the size corresponding to the given sizeType.
    @@ -629,15 +640,19 @@ NotFoundError - If the device has no widgets or if a widget with the given id do
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Widget size width: 712, height: 712
    @@ -775,17 +790,21 @@ Precondition: Widget tag in the config.xml file includes the "nodisplay" attribu
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Widget name is Gallery
    @@ -842,24 +861,30 @@ SecurityError - If the widget does not belong to the package of the web applicat
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     Instances array size: 3
    @@ -905,17 +930,21 @@ SecurityError - If the widget does not belong to the package of the web applicat
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Variant preview image path is /usr/share/icons/default/small/preview_gallery_4x4.png
    @@ -965,24 +994,30 @@ AbortError - If the operation cannot be finished properly.              
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     Variants array size: 4
    @@ -1028,21 +1063,26 @@ AbortError - If the operation cannot be finished properly.              
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     Listener with id 1 has been added.
    @@ -1080,23 +1120,28 @@ AbortError - If the operation cannot be finished properly.              
     
             
    -

    Code example:

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

    Code example:

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

    Output example:

     Listener with id 1 has been removed.
    @@ -1336,17 +1381,21 @@ Every visual widget element added to the home screen is a single instance of som
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Update period has been set to 2 seconds.
    @@ -1400,21 +1449,26 @@ This function does not wait for a confirmation that the data was updated.
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Data has been successfully sent
    @@ -1466,31 +1520,38 @@ AbortError - If the operation cannot be finished properly.              
     
             
    -

    Code example:

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

    Code example:

    +/* 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);
    +}
    +

    Output example:

     Data has been obtained successfully
    - data1 : test1
    - data2 : test2
    + data1: test1
    + data2: test2
      
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Animation/animation.htm b/org.tizen.web.apireference/html/ui_fw_api/Animation/animation.htm index ae5abe8..2981dee 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Animation/animation.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Animation/animation.htm @@ -56,7 +56,7 @@ -
    stop (  ) 
    +
    stop() 

    Stops animation or group animations.

    @@ -65,7 +65,7 @@ -
    transform (  ) 
    +
    transform() 

    Sets transform property of target.

    @@ -74,14 +74,14 @@ -
    tween (  ) 
    +
    tween() 

    Adds tween animation with animation information and target is animated.

    -
    Target target ( String str ) 
    +
    Target target(String str) 

    Returns animation target object

    @@ -99,7 +99,7 @@

    Stops animation or group animations.

    -
    stop ( ) 
    +
    stop()
    @@ -129,7 +129,7 @@

    Sets transform property of target.

    -
    transform ( ) 
    +
    transform()
    @@ -159,7 +159,7 @@

    Adds tween animation with animation information and target is animated.

    -
    tween ( ) 
    +
    tween()
    @@ -187,7 +187,7 @@

    Returns animation target object

    -
    Target target ( String str) 
    +
    Target target(String str)
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Base/popup.htm b/org.tizen.web.apireference/html/ui_fw_api/Base/popup.htm index bde0295..c7a0a5f 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Base/popup.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Base/popup.htm @@ -40,10 +40,9 @@
    <!--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>
    /* JavaScript code */
    @@ -100,10 +99,10 @@
     
     
    <!--Popup html code-->
     <div id="popup" class="ui-popup">
    -      <div class="ui-popup-header"></div>
    -      <div class="ui-popup-content"></div>
    -   </div>
    -</div>
    /* JavaScript code */
    +   <div class="ui-popup-header"></div>
    +   <div class="ui-popup-content"></div>
    +</div>
    +
    /* JavaScript code */
     <script>
        /* Use popup events */
        var popup = document.getElementById("popup");
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/drag.htm b/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/drag.htm
    index e157ed3..1714aad 100755
    --- a/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/drag.htm
    +++ b/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/drag.htm
    @@ -92,36 +92,42 @@
     
     
     <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>
     

    Javascript

    -(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");
    +      });
    +   });
     }());
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/gesture.htm b/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/gesture.htm index f2c0af0..e3845ab 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/gesture.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/gesture.htm @@ -84,11 +84,13 @@
     /* 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");
     });
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/swipe.htm b/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/swipe.htm index b07eec2..49657fb 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/swipe.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Gesture_Events/swipe.htm @@ -71,28 +71,32 @@
     <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>
     

    Javascript

    -(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);
    +      });
    +   });
     }());
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Globalization/globalization.htm b/org.tizen.web.apireference/html/ui_fw_api/Globalization/globalization.htm index 6b7afee..0f4c5db 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Globalization/globalization.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Globalization/globalization.htm @@ -57,7 +57,7 @@ -
    Object getCalendar (  ) 
    +
    Object getCalendar()

    Get gregorian calendar.

    @@ -66,7 +66,7 @@ -
    string getLocale (  ) 
    +
    string getLocale()

    Get Locale.

    @@ -75,7 +75,7 @@ -
    importModule ( string fileName ) 
    +
    importModule(string fileName) 

    Put the module into module array of core.util.globalize

    @@ -84,9 +84,9 @@ -
    Deferred setLocale ( string localeId ) 
    +
    Deferred setLocale(string localeId) 
    -

    Set Locale. This API is Async API.
    Please use deferred callback functions which are returned( .done(), .then() .etc)

    +

    Set Locale. This API is Async API.
    Please use deferred callback functions which are returned (.done(), .then() .etc)

    @@ -102,7 +102,7 @@

    Get gregorian calendar.

    -
    Object getCalendar ( ) 
    +
    Object getCalendar() 
    @@ -143,7 +143,7 @@

    Get Locale.

    -
    string getLocale ( ) 
    +
    string getLocale() 
    @@ -184,7 +184,7 @@

    Put the module into module array of core.util.globalize

    -
    importModule ( string fileName) 
    +
    importModule(string fileName) 
    @@ -235,10 +235,10 @@ id="method-setLocale">setLocale
    -

    Set Locale. This API is Async API.
    Please use deferred callback functions which are returned( .done(), .then() .etc)

    +

    Set Locale. This API is Async API.
    Please use deferred callback functions which are returned (.done(), .then() .etc)

    -
    Deferred setLocale ( string localeId) 
    +
    Deferred setLocale(string localeId) 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Checkboxradio.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Checkboxradio.htm index 9a68511..b7ce33e 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Checkboxradio.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Checkboxradio.htm @@ -45,7 +45,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    To create a checkbox radio component:

    -
    <input type="checkbox" name="checkbox-yes" id="checkbox-yes" />
    +
    <input type="checkbox" name="checkbox-yes" id="checkbox-yes"/>
     <label for="checkbox-yes">Yes</label>
     
    @@ -67,7 +67,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    disable (  ) 
    +
    disable() 

    Disables the component.

    @@ -76,14 +76,14 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    enable (  ) 
    +
    enable() 

    Enables the component.

    -
    getCheckedElement (  ) 
    +
    getCheckedElement() 

    Returns a checked checkbox radio element.

    @@ -124,7 +124,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Disables the component.

    -
    disable ( ) 
    +
    disable() 
    @@ -158,7 +158,8 @@ To support Backward compatibility, please import tau.support-2.3.js. example:

    -<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);
    @@ -179,7 +180,7 @@ To support Backward compatibility, please import tau.support-2.3.js.
     						

    Enables the component.

    -
    enable ( ) 
    +
    enable() 
    @@ -213,7 +214,8 @@ To support Backward compatibility, please import tau.support-2.3.js. example:

    -<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);
    @@ -233,7 +235,7 @@ To support Backward compatibility, please import tau.support-2.3.js.
     						

    Returns a checked checkbox radio element.

    -
    HTMLElement getCheckedElement ( ) 
    +
    HTMLElement getCheckedElement() 
    @@ -267,12 +269,13 @@ To support Backward compatibility, please import tau.support-2.3.js. example:

    -<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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Collapsible.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Collapsible.htm index 9b29f93..ab6f056 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Collapsible.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Collapsible.htm @@ -248,7 +248,7 @@ collapsible.methodName(methodArgument1, methodArgument2, ...); -
    disable (  ) 
    +
    disable() 

    Disables the collapsible component.

    @@ -257,7 +257,7 @@ collapsible.methodName(methodArgument1, methodArgument2, ...); -
    enable (  ) 
    +
    enable() 

    Enables the collapsible component.

    @@ -266,7 +266,7 @@ collapsible.methodName(methodArgument1, methodArgument2, ...); -
    refresh (  ) 
    +
    refresh() 

    Refreshes the collapsible component.

    @@ -315,7 +315,7 @@ collapsible.methodName(methodArgument1, methodArgument2, ...);

    Disables the collapsible component.

    -
    Collapsible disable ( ) 
    +
    Collapsible disable() 
    @@ -390,7 +390,7 @@ collapsible.methodName(methodArgument1, methodArgument2, ...);

    Enables the collapsible component.

    -
    Collapsible enable ( ) 
    +
    Collapsible enable() 
    @@ -462,7 +462,7 @@ collapsible.methodName(methodArgument1, methodArgument2, ...);

    Refreshes the collapsible component.

    -
    Collapsible refresh ( ) 
    +
    Collapsible refresh() 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_FastScroll.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_FastScroll.htm index cef2c6b..4a5a885 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_FastScroll.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_FastScroll.htm @@ -170,7 +170,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    destroy (  ) 
    +
    destroy() 

    Destroys the component.

    @@ -180,7 +180,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    string indexString ( string? indexAlphabet ) 
    +
    string indexString(string? indexAlphabet) 

    Gets or sets an index string.

    @@ -190,7 +190,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    refresh (  ) 
    +
    refresh() 

    Refreshes the component.

    @@ -204,7 +204,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Destroys the component.

    -
    destroy ( )
    +
    destroy()

    Since: @@ -289,7 +289,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Gets or sets an index string.

    -
    ?string indexString ( string? indexAlphabet) 
    +
    ?string indexString(string? indexAlphabet) 

    Since: @@ -367,12 +367,12 @@ To support Backward compatibility, please import tau.support-2.3.js.    </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> @@ -410,7 +410,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Refreshes the component.

    -
    refresh ( ) 
    +
    refresh() 

    Since: diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Gallery.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Gallery.htm index 87469b7..287cdb6 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Gallery.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Gallery.htm @@ -117,54 +117,54 @@ To support Backward compatibility, please import tau.support-2.3.js. -

    add ( string file ) 
    +
    add(string file) 

    Adds an image to the gallery.

    -
    empty (  ) 
    +
    empty() 

    Removes all images from the gallery.

    -
    hide (  ) 
    +
    hide() 

    Hides the gallery.

    -
    number length (  ) 
    +
    number length() 

    Gets the number of images.

    -
    ?number refresh ( number? startIndex ) 
    +
    ?number refresh(number? startIndex) 

    Refreshes the gallery.

    -
    remove ( number? index ) 
    +
    remove(number? index) 

    Deletes a specific image from the gallery.
    If no parameter is defined, the current image is deleted.

    -
    show (  ) 
    +
    show() 

    Displays the gallery.

    -
    ?number value ( number index ) 
    +
    ?number value(number index) 

    Gets or sets the current index of the gallery.

    @@ -179,7 +179,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Adds an image to the gallery.

    -
    add ( string file) 
    +
    add(string file) 
    @@ -227,7 +227,7 @@ To support Backward compatibility, please import tau.support-2.3.js. 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();
    @@ -238,7 +238,7 @@ galleryWidget.refresh(); 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 */ @@ -253,7 +253,7 @@ $("#gallery").gallery("refresh"); // To see changes, "r Removes all images from the gallery.

    -
    empty ( ) 
    +
    empty() 
    @@ -275,7 +275,7 @@ Removes all images from the gallery.

    prettyprint"> var galleryWidget = tau.widget.Gallery(document.getElementById("gallery")); -galleryWidget.empty(); // All images are deleted +galleryWidget.empty(); /* All images are deleted */
    @@ -296,7 +296,7 @@ $("#gallery").gallery("empty");

    Hides the gallery.

    -
    hide ( ) 
    +
    hide() 
    @@ -319,7 +319,7 @@ $("#gallery").gallery("empty"); prettyprint"> var galleryWidget = tau.widget.Gallery(document.getElementById("gallery")); -galleryWidget.hide(); // Gallery is hidden +galleryWidget.hide(); /* Gallery is hidden */
    @@ -340,7 +340,7 @@ $("#gallery").gallery("hide");

    Gets the number of images.

    -
    number length ( ) 
    +
    number length() 
    @@ -374,7 +374,7 @@ $("#gallery").gallery("hide"); var galleryWidget = tau.widget.Gallery(document.getElementById("gallery")),     imagesItems; -imagesLength = galleryWidget.length(); // Number of images +imagesLength = galleryWidget.length(); /* Number of images */
    @@ -395,7 +395,7 @@ imagesLength = $("#gallery").gallery("length");

    Refreshes the gallery.

    -
    ?number refresh ( number? startIndex) 
    +
    ?number refresh(number? startIndex) 
    @@ -457,7 +457,7 @@ imagesLength = $("#gallery").gallery("length"); 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); @@ -470,7 +470,7 @@ 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); @@ -486,7 +486,7 @@ galleryWidget.value(0);

    Deletes a specific image from the gallery.
    If no parameter is defined, the current image is deleted.

    -
    remove ( number? index) 
    +
    remove(number? index) 
    @@ -533,7 +533,7 @@ galleryWidget.value(0); prettyprint"> var galleryWidget = tau.widget.Gallery(document.getElementById("gallery")); -galleryWidget.remove(0); // First image is removed +galleryWidget.remove(0); /* First image is removed */
    @@ -554,7 +554,7 @@ $("#gallery").gallery("remove", 0);

    Displays the gallery.

    -
    show ( ) 
    +
    show() 
    @@ -598,7 +598,7 @@ $("#gallery").gallery("show");

    Gets or sets the current index of the gallery.

    -
    ?number value ( number index) 
    +
    ?number value(number index) 
    @@ -658,9 +658,9 @@ $("#gallery").gallery("show");
     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 */
     
    @@ -668,9 +668,9 @@ galleryWidget.value(0); // First image is displayed example (jQuery API support for backward compatibility):

    -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 */
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_MultimediaView.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_MultimediaView.htm index c51884b..8098049 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_MultimediaView.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_MultimediaView.htm @@ -44,7 +44,7 @@
     <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>
    @@ -54,7 +54,7 @@
     
     <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>
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Notification.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Notification.htm
    index 3a8b157..b3356ca 100644
    --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Notification.htm
    +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Notification.htm
    @@ -89,10 +89,10 @@ To support Backward compatibility, please import tau.support-2.3.js.
        <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>
     
    @@ -108,7 +108,7 @@ To support Backward compatibility, please import tau.support-2.3.js.    <p>Line of message</p> </div> <script> -   // Open component using jQuery notation +   /* Open component using jQuery notation */    $("#notification").notification("open") </script>
    @@ -142,10 +142,10 @@ To support Backward compatibility, please import tau.support-2.3.js.    <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> @@ -161,7 +161,7 @@ To support Backward compatibility, please import tau.support-2.3.js.    <p>Second line of message</p> </div> <script> -   // Open component using jQuery notation +   /* Open component using jQuery notation */    $("#notification").notification("open") </script> @@ -173,12 +173,12 @@ To support Backward compatibility, please import tau.support-2.3.js.

    To create a ticker notification with an icon using the TAU API (RECOMMENDED):

    <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>
     
    @@ -190,12 +190,12 @@ To support Backward compatibility, please import tau.support-2.3.js.

    To create a ticker notification with an icon using the jQuery API (support for backward compatibility):

    <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>
     
    @@ -217,15 +217,15 @@ To support Backward compatibility, please import tau.support-2.3.js.

    To create a notification with an interval using the TAU API (RECOMMENDED):

    <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>
     
    @@ -237,12 +237,12 @@ To support Backward compatibility, please import tau.support-2.3.js.

    To create a notification with an interval using the jQuery API (support for backward compatibility):

    <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>
     
    @@ -297,7 +297,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    close (  ) 
    +
    close() 

    Closes the notification on the screen.

    @@ -306,7 +306,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    destroy (  ) 
    +
    destroy() 

    Removes the component.

    @@ -315,7 +315,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    disable (  ) 
    +
    disable() 

    Disables the component.

    @@ -324,7 +324,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    enable (  ) 
    +
    enable() 

    Enables the component.

    @@ -333,7 +333,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    icon ( string src ) 
    +
    icon(string src) 

    Creates an icon or changes an existing icon to a new one.

    @@ -342,7 +342,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    open (  ) 
    +
    open() 

    Displays the notification on the screen.

    @@ -351,7 +351,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    Notification refresh (  ) 
    +
    Notification refresh() 

    Refreshes the notification and resets its interval, if specified.

    @@ -360,7 +360,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    Array text ( string text0, string text1 ) 
    +
    Array text(string text0, string text1) 

    Gets or sets the notification text.

    @@ -377,7 +377,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Closes the notification on the screen.

    -
    close ( ) 
    +
    close() 
    @@ -438,7 +438,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Removes the component.

    -
    destroy ( ) 
    +
    destroy() 
    @@ -489,7 +489,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Disables the component.

    -
    disable ( ) 
    +
    disable() 
    @@ -515,10 +515,10 @@ To support Backward compatibility, please import tau.support-2.3.js.    <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> @@ -533,7 +533,7 @@ To support Backward compatibility, please import tau.support-2.3.js.    <p>Line of message</p> </div> <script> -   // Disable component +   /* Disable component */    $("#notification").notification("disable"); </script> @@ -550,7 +550,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Enables the component.

    -
    enable ( ) 
    +
    enable() 
    @@ -576,10 +576,10 @@ To support Backward compatibility, please import tau.support-2.3.js.    <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> @@ -594,7 +594,7 @@ To support Backward compatibility, please import tau.support-2.3.js.    <p>Line of message</p> </div> <script> -   // Enable component +   /* Enable component */    $("#notification").notification("enable"); </script> @@ -611,7 +611,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Creates an icon or changes an existing icon to a new one.

    -
    icon ( string src) 
    +
    icon(string src) 
    @@ -692,7 +692,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Displays the notification on the screen.

    -
    open ( ) 
    +
    open() 
    @@ -753,7 +753,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Refreshes the notification and resets its interval, if specified.

    -
    Notification refresh ( ) 
    +
    Notification refresh() 
    @@ -825,7 +825,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Gets or sets the notification text.

    -
    Array text ( string text0, string text1) 
    +
    Array text(string text0, string text1) 
    @@ -899,7 +899,7 @@ To support Backward compatibility, please import tau.support-2.3.js.    var widgetText = notification.text();    alert(widgetText); -   // Alert "Line of message,Second line of message" +   /* Alert "Line of message,Second line of message" */ </script>
    @@ -917,7 +917,7 @@ To support Backward compatibility, please import tau.support-2.3.js.    var widgetText = $("#notificationSelector").notification("text");    alert(widgetText); -   // Alert "Line of message,Second line of message" +   /* Alert "Line of message,Second line of message" */ </script> diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_ProgressBar.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_ProgressBar.htm index bff30cd..e252794 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_ProgressBar.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_ProgressBar.htm @@ -197,7 +197,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    ProgressBar refresh (  ) 
    +
    ProgressBar refresh() 

    Refreshes a progress bar.

    @@ -208,7 +208,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    number value ( number? value ) 
    +
    number value(number? value) 

    Gets or sets a value.

    @@ -225,7 +225,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Refreshes a progress bar.

    -
    ProgressBar refresh ( ) 
    +
    ProgressBar refresh() 
    @@ -298,7 +298,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Gets or sets a value.

    -
    number value ( number? value) 
    +
    number value(number? value) 

    Since: @@ -366,10 +366,10 @@ To support Backward compatibility, please import tau.support-2.3.js. <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> @@ -381,10 +381,10 @@ To support Backward compatibility, please import tau.support-2.3.js. <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> diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_ScrollHandler.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_ScrollHandler.htm index f0e357c..1bb41bf 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_ScrollHandler.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_ScrollHandler.htm @@ -339,7 +339,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -

    boolean enableHandler ( boolean enable ) 
    +
    boolean enableHandler(boolean enable) 

    Enables or disables the handler.

    @@ -357,7 +357,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Enables or disables the handler.

    -
    boolean enableHandler ( boolean enable) 
    +
    boolean enableHandler(boolean enable) 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_SearchBar.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_SearchBar.htm index c575bc3..ed4a01d 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_SearchBar.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_SearchBar.htm @@ -81,7 +81,7 @@ To support Backward compatibility, please import tau.support-2.3.js.       </ul>    </div>    <script> -      (function (document) +      (function(document)       {          var inputElement = document.getElementById("search-bar"),              contentElement = document.getElementById("search-bar-content"), @@ -145,7 +145,7 @@ To support Backward compatibility, please import tau.support-2.3.js.       </ul>    </div>    <script> -      (function (document) +      (function(document)       {          var inputElement = document.getElementById("search-bar"),              contentElement = document.getElementById("search-bar-content"), @@ -206,7 +206,7 @@ To support Backward compatibility, please import tau.support-2.3.js.       </ul>    </div>    <script> -      (function (document) +      (function(document)       {          var inputElement = document.getElementById("search-bar"),              contentElement = document.getElementById("search-bar-content"), @@ -307,7 +307,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    SearchBar disable (  ) 
    +
    SearchBar disable() 

    Disables the search bar.

    @@ -316,7 +316,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    SearchBar enable (  ) 
    +
    SearchBar enable() 

    Enables the search bar.

    @@ -329,7 +329,7 @@ To support Backward compatibility, please import tau.support-2.3.js. -
    string value ( string? value ) 
    +
    string value(string? value) 

    Gets or sets an input text value.

    @@ -347,7 +347,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Disables the search bar.

    -
    SearchBar disable ( ) 
    +
    SearchBar disable() 
    @@ -412,7 +412,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Enables the search bar.

    -
    SearchBar enable ( ) 
    +
    SearchBar enable() 
    @@ -482,7 +482,7 @@ To support Backward compatibility, please import tau.support-2.3.js.

    Gets or sets an input text value.

    -
    string value ( string? value) 
    +
    string value(string? value) 

    Since: @@ -556,10 +556,10 @@ var searchBarElement = document.getElementById("searchbar"), example (jQuery API support for backward compatibility):

    -// 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");   
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_SelectMenu.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_SelectMenu.htm index 3e49623..6041d51 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_SelectMenu.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_SelectMenu.htm @@ -193,7 +193,7 @@ widget.methodName(methodArgument1, methodArgument2, ...); -
    open (  ) 
    +
    open() 

    Opens the select menu.

    @@ -202,7 +202,7 @@ widget.methodName(methodArgument1, methodArgument2, ...); -
    close (  ) 
    +
    close() 

    Closes the select menu.

    @@ -220,7 +220,7 @@ widget.methodName(methodArgument1, methodArgument2, ...);

    Opens the select menu.

    -
    open ( ) 
    +
    open() 
    @@ -267,7 +267,7 @@ widget.methodName(methodArgument1, methodArgument2, ...);

    Closes the select menu.

    -
    close ( ) 
    +
    close() 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Swipe.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Swipe.htm index 60bac25..ec1ca2d 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Swipe.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Swipe.htm @@ -129,7 +129,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr -
    open (  ) 
    +
    open() 

    Runs opening animations.

    @@ -138,7 +138,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr -
    boolean opened (  ) 
    +
    boolean opened() 

    Checks whether a swipe element is opened.

    @@ -147,7 +147,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr -
    close (  ) 
    +
    close() 

    Runs closing animations.

    @@ -168,7 +168,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr

    Runs opening animations.

    -
    open ( ) 
    +
    open() 
    @@ -207,7 +207,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr example (jQuery API support for backward compatibility):

    -<div  id="swipe" data-role="swipe">
    +<div id="swipe" data-role="swipe">
        <div data-role="swipe-item-cover">
           Swipe
        </div>
    @@ -233,7 +233,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr
     						

    Checks whether a swipe element is opened.

    -
    boolean opened ( ) 
    +
    boolean opened() 
    @@ -281,7 +281,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr example (jQuery API support for backward compatibility):

    -<div  id="swipe" data-role="swipe">
    +<div id="swipe" data-role="swipe">
        <div data-role="swipe-item-cover">
           Swipe
        </div>
    @@ -307,7 +307,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr
     						

    Runs closing animations.

    -
    close ( ) 
    +
    close() 
    @@ -395,7 +395,7 @@ $(".selector").swipe("methodName", methodArgument1, methodAr </div> <script>    var swipeWidget = tau.widget.Swipe(document.getElementById("swipe")); -       swipeWidget.open(); +   swipeWidget.open(); <script>
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_TabBar.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_TabBar.htm index 1c2fa6a..daf6496 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_TabBar.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_TabBar.htm @@ -80,7 +80,7 @@ To support Backward compatibility, please import tau.support-2.3.js.    </div> </div> <script> -   (function (document) +   (function(document)    {       var pageElement = document.getElementById("tab-bar-page"),           tabBarElement = document.getElementById("ready-for-tab-bar"), @@ -115,7 +115,7 @@ To support Backward compatibility, please import tau.support-2.3.js.    </div> </div> <script> -   (function (document) +   (function(document)    {       function createPageHandle()       { diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Tokentextarea.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Tokentextarea.htm index a8e8d7e..ccd4dcd 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Tokentextarea.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/deprecated/mobile_Tokentextarea.htm @@ -154,22 +154,22 @@ To support Backward compatibility, please import tau.support-2.3.js.    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> @@ -206,7 +206,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); -
    add ( string messages, number blockIndex ) 
    +
    add(string messages, number blockIndex) 

    Adds a new token text area component button with specified text in the place of the index.

    @@ -214,7 +214,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); -
    Tokentextarea disable (  ) 
    +
    Tokentextarea disable() 

    Disables the token text area.

    @@ -222,14 +222,14 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); -
    Tokentextarea enable (  ) 
    +
    Tokentextarea enable() 

    Enables the token text area.

    -
    focusIn (  ) 
    +
    focusIn() 

    Ungroups the elements and sets a focus to the input.

    @@ -238,7 +238,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); -
    focusOut (  ) 
    +
    focusOut() 

    Groups elements and hides the input.

    @@ -251,7 +251,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); -
    string inputText ( string text ) 
    +
    string inputText(string text) 

    Manages the component input box text.

    @@ -264,7 +264,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); -
    number length (  ) 
    +
    number length() 

    Returns the block count.

    @@ -272,14 +272,14 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); -
    remove ( number blockIndex ) 
    +
    remove(number blockIndex) 

    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.

    -
    ?string select ( number blockIndex ) 
    +
    ?string select(number blockIndex) 

    Selects the token text area button based on its index value.
    If a parameter is set, the token text area button matching the index value is selected.
    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.

    @@ -297,7 +297,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    Adds a new token text area component button with specified text in the place of the index.

    -
    add ( string messages, number blockIndex) 
    +
    add(string messages, number blockIndex) 
    @@ -387,7 +387,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    Disables the token text area.

    -
    Tokentextarea disable ( ) 
    +
    Tokentextarea disable() 
    @@ -437,7 +437,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    Enables the token text area.

    -
    Tokentextarea enable ( ) 
    +
    Tokentextarea enable() 
    @@ -485,7 +485,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    Ungroups the elements and sets a focus to the input.

    -
    focusIn ( ) 
    +
    focusIn() 
    @@ -544,7 +544,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    Groups elements and hides the input.

    -
    focusOut ( ) 
    +
    focusOut() 
    @@ -607,7 +607,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    Manages the component input box text.

    -
    string inputText ( string text) 
    +
    string inputText(string text) 
    @@ -671,10 +671,10 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); <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> @@ -686,10 +686,10 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); 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> @@ -710,7 +710,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    Returns the block count.

    -
    number length ( ) 
    +
    number length() 
    @@ -777,7 +777,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    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.

    -
    remove ( number blockIndex) 
    +
    remove(number blockIndex) 
    @@ -855,7 +855,7 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...);

    Selects the token text area button based on its index value.
    If a parameter is set, the token text area button matching the index value is selected.
    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.

    -
    ?string select ( number blockIndex) 
    +
    ?string select(number blockIndex) 
    @@ -915,13 +915,13 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); 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> @@ -933,12 +933,12 @@ tokentextarea.methodName(methodArgument1, methodArgument2, ...); 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> diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Button.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Button.htm index 2bcaed4..46cd1f0 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Button.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Button.htm @@ -177,8 +177,10 @@ In addition, all elements with the class="ui-btn" and @@ -196,7 +198,7 @@ In addition, all elements with the class="ui-btn" and -
    Button disable (  ) 
    +
    Button disable() 

    Disables the button.

    @@ -205,7 +207,7 @@ In addition, all elements with the class="ui-btn" and -
    Button enable (  ) 
    +
    Button enable() 

    Enables the button.

    @@ -214,7 +216,7 @@ In addition, all elements with the class="ui-btn" and -
    Button refresh (  ) 
    +
    Button refresh() 

    Refreshes a button markup.

    @@ -224,7 +226,7 @@ In addition, all elements with the class="ui-btn" and -
    string value ( string? value ) 
    +
    string value(string? value) 

    Gets or sets a value.

    @@ -243,7 +245,7 @@ In addition, all elements with the class="ui-btn" and Disables the button.

    -
    Button disable ( ) 
    +
    Button disable() 
    @@ -300,7 +302,7 @@ In addition, all elements with the class="ui-btn" and Enables the button.

    -
    Button enable ( ) 
    +
    Button enable() 
    @@ -358,7 +360,7 @@ In addition, all elements with the class="ui-btn" and Refreshes a button markup.

    -
    Button refresh ( ) 
    +
    Button refresh() 
    @@ -419,7 +421,7 @@ In addition, all elements with the class="ui-btn" and Gets or sets a value.

    -
    string value ( string? value) 
    +
    string value(string? value) 

    Since: @@ -488,10 +490,10 @@ In addition, all elements with the class="ui-btn" and diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Checkbox.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Checkbox.htm index 56cf3c1..c4757ea 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Checkbox.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Checkbox.htm @@ -64,7 +64,7 @@ -

    disable (  ) 
    +
    disable() 

    Disables the component.

    @@ -73,14 +73,14 @@ -
    enable (  ) 
    +
    enable() 

    Enables the component.

    -
    value ( ) 
    +
    value() 

    Set/Return a value from checkbox element.

    @@ -97,7 +97,7 @@

    Disables the component.

    -
    disable ( ) 
    +
    disable() 
    @@ -131,7 +131,8 @@ example:

    -<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);
    @@ -152,7 +153,7 @@
     			

    Enables the component.

    -
    enable ( ) 
    +
    enable() 
    @@ -186,7 +187,8 @@ example:

    -<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);
    @@ -206,7 +208,7 @@
     			

    Set/Return a value from checkbox element.

    -
    { string | number } value ( ) 
    +
    {string | number} value() 
    @@ -240,14 +242,15 @@ example:

    -<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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_ColoredListview.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_ColoredListview.htm index 4563f41..0fc33b3 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_ColoredListview.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_ColoredListview.htm @@ -40,7 +40,7 @@ </ul> <script>    var elColoredList = document.getElementById("coloredlist"), -        coloredList = tau.widget.ColoredListview(elColoredList); +       coloredList = tau.widget.ColoredListview(elColoredList); </script> diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Drawer.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Drawer.htm index a9b6452..20520bc 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Drawer.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Drawer.htm @@ -143,7 +143,7 @@ -
    close (  ) 
    +
    close() 

    Closes the drawer.

    @@ -152,14 +152,14 @@ -
    isOpen (  ) 
    +
    isOpen() 

    Checks the drawer status.

    -
    open (  ) 
    +
    open() 

    Opens the drawer.

    @@ -191,7 +191,7 @@

    Closes the drawer.

    -
    close ( ) 
    +
    close() 
    @@ -240,7 +240,7 @@

    Checks the drawer status.

    -
    isOpen ( ) 
    +
    isOpen() 
    @@ -297,7 +297,7 @@

    Opens the drawer.

    -
    open ( ) 
    +
    open() 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_DropdownMenu.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_DropdownMenu.htm index 8d2139b..090e620 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_DropdownMenu.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_DropdownMenu.htm @@ -40,27 +40,29 @@ DropdownMenu component allows you to create the component in the form of a drop-

    For manual creation of DropdownMenu component you can use constructor of component.

    -
        <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>
    +
    +<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>
     

    HTML Examples

    Basic

    -
    <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 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>
     
    @@ -69,23 +71,25 @@ DropdownMenu component allows you to create the component in the form of a drop-

    When data-inline attribute is set to true, width of the DropdownMenu is determined by its text.

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

    With Placeholder

    If you use <option> with data-placeholder="true" attribute, you can make a default placeholder.

    -
    <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 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>
     
    @@ -148,7 +152,7 @@ widget.methodName(methodArgument1, methodArgument2, ...); -
    open (  ) 
    +
    open() 

    Open DropdownMenu

    @@ -157,7 +161,7 @@ widget.methodName(methodArgument1, methodArgument2, ...); -
    close (  ) 
    +
    close() 

    Close DropdownMenu

    @@ -165,7 +169,7 @@ widget.methodName(methodArgument1, methodArgument2, ...); -
    enable (  ) 
    +
    enable() 

    Enable DropdownMenu

    @@ -174,7 +178,7 @@ widget.methodName(methodArgument1, methodArgument2, ...); -
    disable (  ) 
    +
    disable() 

    Disable DropdownMenu

    @@ -192,7 +196,7 @@ widget.methodName(methodArgument1, methodArgument2, ...);

    Open DropdownMenu

    -
    open ( ) 
    +
    open() 
    @@ -217,16 +221,16 @@ widget.methodName(methodArgument1, methodArgument2, ...);
     <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>
     
    @@ -241,7 +245,7 @@ widget.open();

    Close DropdownMenu

    -
    close ( ) 
    +
    close() 
    @@ -266,16 +270,16 @@ widget.open();
     <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>
     
    @@ -290,7 +294,7 @@ widget.close();

    Enable DropdownMenu

    -
    enable ( ) 
    +
    enable() 
    @@ -329,16 +333,16 @@ widget.close();
     <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>
     
    @@ -355,7 +359,7 @@ widget.enable();

    Disable DropdownMenu

    -
    disable ( ) 
    +
    disable() 
    @@ -394,16 +398,16 @@ widget.enable();
     <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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Expandable.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Expandable.htm index 9d1d7d6..730a694 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Expandable.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Expandable.htm @@ -152,7 +152,7 @@ expandableWidget.methodName(methodArgument1, methodArgument2, ...); -
    disable (  ) 
    +
    disable() 

    Disables the expandable component.

    @@ -161,7 +161,7 @@ expandableWidget.methodName(methodArgument1, methodArgument2, ...); -
    enable (  ) 
    +
    enable() 

    Enables the expandable component.

    @@ -179,7 +179,7 @@ expandableWidget.methodName(methodArgument1, methodArgument2, ...);

    Disables the expandable component.

    -
    disable ( ) 
    +
    disable() 
    @@ -240,7 +240,7 @@ expandableWidget.methodName(methodArgument1, methodArgument2, ...);

    Enables the expandable component.

    -
    enable ( ) 
    +
    enable() 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_GridView.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_GridView.htm index 486741c..69e35d5 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_GridView.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_GridView.htm @@ -38,19 +38,19 @@
     <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>
    @@ -139,7 +139,7 @@ gridView.methodName(methodArgument1, methodArgument2, ...);
     	
     	
     		
    -			
    addItem (  ) 
    +
    addItem() 

    Add an item to grid view

    @@ -148,7 +148,7 @@ gridView.methodName(methodArgument1, methodArgument2, ...); -
    removeItem (  ) 
    +
    removeItem() 

    Remove an item from grid view

    @@ -166,7 +166,7 @@ gridView.methodName(methodArgument1, methodArgument2, ...);

    Add an item to grid view

    -
    addItem (HTMLElement item) 
    +
    addItem(HTMLElement item) 
    @@ -207,11 +207,11 @@ gridView.methodName(methodArgument1, methodArgument2, ...);
     <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>
     
    @@ -225,7 +225,7 @@ gridView.addItem(item);

    Remove an item from grid view

    -
    removeItem (HTMLElement item) 
    +
    removeItem(HTMLElement item) 
    @@ -266,11 +266,11 @@ gridView.addItem(item);
     <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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Navigation.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Navigation.htm index 68f70fe..8944c67 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Navigation.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Navigation.htm @@ -82,7 +82,7 @@    <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"> @@ -103,47 +103,61 @@ </div>

    JS example with PanelChanger

    -
    <!-- in panel.js -->
    -(function() {
    +
    +/* 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");
        });
     })();
    -    
    +
    @@ -164,19 +178,19 @@ -
    create ( ) 
    +
    create() 

    Initiates the making of the navigation.

    -
    push ( String targetId ) 
    +
    push(String targetId) 

    Add navigation item only one at a time.

    -
    pop ( ) 
    +
    pop() 

    Pop last child of navigation.

    @@ -194,7 +208,7 @@

    Initiates the making of the navigation.

    -
    create ( ) 
    +
    create() 
    @@ -219,7 +233,7 @@

    Add navigation item only one at a time.

    -
    push ( String targetId ) 
    +
    push(String targetId) 
    @@ -264,9 +278,9 @@ </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>
    @@ -285,7 +299,7 @@

    Pop last child of navigation.

    -
    pop ( ) 
    +
    pop() 
    @@ -299,7 +313,7 @@ </div> <script>    var navigation = page.querySelector("#navigation"), -      navigationComponent = tau.widget.Navigation(navigation); +       navigationComponent = tau.widget.Navigation(navigation);        navigationComponent.pop(); </script> diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_PageIndicator.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_PageIndicator.htm index a81aea6..411fbed 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_PageIndicator.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_PageIndicator.htm @@ -75,7 +75,7 @@ var elPageIndicator = document.getElementById("pageIndicator"), <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"> @@ -102,10 +102,13 @@ var elPageIndicator = document.getElementById("pageIndicator"), </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> @@ -139,24 +142,24 @@ var elPageIndicator = document.getElementById("pageIndicator"),

    -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).
    +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).

     <div id="pageIndicator" class="ui-page-indicator" data-number-of-pages="5" data-max-page="3"></div>
     

    -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 )
    +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)
    would be indicated by the central dot, from middle of the pages.

    -So, the first dot is for the first page, and the last dot is for the fifth( the last) page.
    +So, the first dot is for the first page, and the last dot is for the fifth (the last) page.
    And the middle dot is shared by 2nd, 3rd and 4th page while scrolling pages.

    -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.
    -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.
    +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.

    Of course, the value of data-number-of-pages should meet the number of the pages you have added to HTML.

    -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.
    +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.
    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.

    @@ -176,7 +179,7 @@ For example, in the situation that the value of numberOfPages is "6", and the va -
    setActive ( number index ) 
    +
    setActive(number index) 

    This method sets a dot to active state.

    @@ -194,7 +197,7 @@ For example, in the situation that the value of numberOfPages is "6", and the va

    This method sets a dot to active state.

    -
    setActive ( number index) 
    +
    setActive(number index) 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_PanelChanger.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_PanelChanger.htm index 7d00dcb..7058f7d 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_PanelChanger.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_PanelChanger.htm @@ -47,7 +47,7 @@ Panel changer component controls lifecycle of the panels.

     var elPanelChanger = document.getElementById("panelchanger"),
    -     panelChanger = tau.widget.PanelChanger(elPanelChanger);
    +    panelChanger = tau.widget.PanelChanger(elPanelChanger);
     

    HTML Examples

    @@ -175,7 +175,7 @@ var elPanelChanger = document.getElementById("panelchanger"), -
    changePanel ( String address, String animationType, String direction ) 
    +
    changePanel(String address, String animationType, String direction) 

    Change panel method

    @@ -193,7 +193,7 @@ var elPanelChanger = document.getElementById("panelchanger"),

    change panel

    -
    changePanel ( String address, String animationType, String direction) 
    +
    changePanel(String address, String animationType, String direction) 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Popup.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Popup.htm index a23fe5a..bd9a395 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Popup.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Popup.htm @@ -121,9 +121,9 @@       <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> @@ -215,11 +215,11 @@ In mobile profile, default value is "origin" and if popup has no optio    <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> @@ -324,8 +324,8 @@ The selector, which causes closing on click, can be changed by setting the @@ -176,21 +178,21 @@ -
    value (  ) 
    +
    value() 

    Sets or gets value of Progress component.

    -
    option (  ) 
    +
    option() 

    Sets or gets options of Progress component.

    -
    refresh (  ) 
    +
    refresh() 

    Refreshes the Progress DOM.

    @@ -207,7 +209,7 @@

    Sets or gets value of Progress component.

    -
    value ( Number value ) 
    +
    value(Number value) 

    @@ -241,11 +243,11 @@        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> @@ -260,7 +262,7 @@

    Sets or gets options of Progress component.

    -
    option ( ) 
    +
    option() 

    @@ -278,10 +280,10 @@        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> @@ -297,7 +299,7 @@

    Refresh Progress DOM.

    -
    refresh ( ) 
    +
    refresh() 

    @@ -312,7 +314,7 @@    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> diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Radio.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Radio.htm index 4172811..cfb9057 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Radio.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Radio.htm @@ -43,9 +43,9 @@

    To create a radio component, please refer following example:

    -
    <input type="radio" name="radio-choice" id="radio-choice-1" value="choice-1" checked="checked" />
    +
    <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>
     
    @@ -64,7 +64,7 @@ -
    disable (  ) 
    +
    disable() 

    Disables the component.

    @@ -73,14 +73,14 @@ -
    enable (  ) 
    +
    enable() 

    Enables the component.

    -
    value ( ) 
    +
    value() 

    Set/Return a value from radio element.

    @@ -97,7 +97,7 @@

    Disables the component.

    -
    disable ( ) 
    +
    disable() 
    @@ -131,7 +131,8 @@ example:

    -<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);
    @@ -152,7 +153,7 @@
     			

    Enables the component.

    -
    enable ( ) 
    +
    enable() 
    @@ -186,7 +187,8 @@ example:

    -<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);
    @@ -206,7 +208,7 @@
     			

    Set/Return a value from radio element.

    -
    { string | number } value ( ) 
    +
    {string | number} value() 
    @@ -240,14 +242,15 @@ example:

    -<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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_SearchInput.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_SearchInput.htm index ad28a6f..a13ef7b 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_SearchInput.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_SearchInput.htm @@ -55,10 +55,10 @@

    To manually create a SearchInput component, use the component constructor from the tau namespace.

    -<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>
     
    @@ -85,14 +85,14 @@ var searchEl = document.getElementById("search-test"), -
    disable (  ) 
    +
    disable() 

    Disable the SearchInput.

    -
    enable (  ) 
    +
    enable() 

    Enable the SearchInput.

    @@ -108,7 +108,7 @@ var searchEl = document.getElementById("search-test"),

    Disable the SearchInput.

    -
    disable ( ) 
    +
    disable() 
    @@ -158,7 +158,7 @@ var searchEl = document.getElementById("search-test"),

    Enable the SearchInput.

    -
    enable ( ) 
    +
    enable() 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_SectionChanger.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_SectionChanger.htm index d749054..e94d1c6 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_SectionChanger.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_SectionChanger.htm @@ -191,21 +191,21 @@ var sectionChangerEl = document.getElementById("sectionchanger"), -
    setActiveSection ( number index ) 
    +
    setActiveSection(number index) 

    Changes the currently active section element (index).
    For smooth scrolling, the duration parameter must be in milliseconds.

    -
    getActiveSectionIndex () 
    +
    getActiveSectionIndex() 

    Gets the currently active section element's index.
    The return value is a number (activeIndex).

    -
    refresh () 
    +
    refresh() 

    Updates the section changer form.
    When you add new section dynamically through JavaScript, you must call the refresh() method to update section information.

    @@ -225,7 +225,7 @@ var sectionChangerEl = document.getElementById("sectionchanger"),
    For smooth scrolling, the duration parameter must be in milliseconds.

    -
    setActiveSection ( number index) 
    +
    setActiveSection(number index) 
    @@ -296,7 +296,7 @@ var sectionChangerEl = document.getElementById("sectionchanger"),
    The return value is a number (activeIndex).

    -
    getActiveSectionIndex () 
    +
    getActiveSectionIndex() 
    @@ -350,7 +350,7 @@ var sectionChangerEl = document.getElementById("sectionchanger"),
    When you add new section dynamically through JavaScript, you must call the refresh() method to update section information.

    -
    refresh () 
    +
    refresh() 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Slider.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Slider.htm index a9ae396..3d7fd60 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Slider.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Slider.htm @@ -48,7 +48,7 @@

    To manually create a slider component, use the component constructor from the tau namespace

    -
    <input id="slider" />
    +
    <input id="slider"/>
     <script>
        var sliderElement = document.getElementById("slider"),
            slider = tau.widget.Slider(sliderElement);
    @@ -61,7 +61,7 @@
     
     

    To create slider input:

    -
    <input type="range" name="slider-1" id="slider" value="60" min="0" max="100" />
    +
    <input type="range" name="slider-1" id="slider" value="60" min="0" max="100"/>
     

    Options

    @@ -105,13 +105,15 @@

    To call a method on the component, use one of the existing APIs:

    -
    <input id="slider" type="range" name="slider" value="60" min="0" max="100" />
    +
    <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>
     
    @@ -128,7 +130,7 @@ -
    Slider disable (  ) 
    +
    Slider disable() 

    Disables the slider.

    @@ -137,7 +139,7 @@ -
    Slider enable (  ) 
    +
    Slider enable() 

    Enables the slider.

    @@ -147,7 +149,7 @@ -
    Slider refresh (  ) 
    +
    Slider refresh() 

    Refreshes a slider markup.

    @@ -157,7 +159,7 @@ -
    string value (  ) 
    +
    string value() 

    Gets or sets a value.

    @@ -175,7 +177,7 @@

    Disables the slider.

    -
    Slider disable ( ) 
    +
    Slider disable() 
    @@ -206,7 +208,7 @@ example:

    -<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);
    @@ -224,7 +226,7 @@
     						

    Enables the slider.

    -
    Slider enable ( ) 
    +
    Slider enable() 
    @@ -260,7 +262,7 @@ example :

    -<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);
    @@ -278,7 +280,7 @@
     						

    Refreshes a slider markup.

    -
    Slider refresh ( ) 
    +
    Slider refresh() 
    @@ -319,7 +321,7 @@ example :

    -<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);
    @@ -338,7 +340,7 @@
     						

    Gets or sets a value.

    -
    string value ( ) 
    +
    string value() 

    Since: @@ -381,13 +383,13 @@ example :

    -<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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Tabs.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Tabs.htm index 62b075e..cdddfd5 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Tabs.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_Tabs.htm @@ -89,11 +89,12 @@ When define tabbar in HTML, just add class="ui-tabbar". P

    For manual creation of tabs widget you can use constructor of widget

    -
     <script>
    -     var tabsElement = document.getElementById("tabs"),
    -           tabs;
    -     tabs = tau.widget.Tabs(tabsElement);
    - </script>
    +
    +<script>
    +   var tabsElement = document.getElementById("tabs"),
    +       tabs;
    +   tabs = tau.widget.Tabs(tabsElement);
    +</script>
     

    Methods list

    @@ -108,13 +109,13 @@ When define tabbar in HTML, just add class="ui-tabbar". P -
    setIndex ( number index ) 
    +
    setIndex(number index) 

    Set the active tab index

    -
    number getIndex (  ) 
    +
    number getIndex() 

    Get the active tab index

    @@ -127,7 +128,7 @@ When define tabbar in HTML, just add class="ui-tabbar". P

    Set the active tab index

    -
    setIndex ( number index) 
    +
    setIndex(number index) 

    @@ -165,7 +166,7 @@ When define tabbar in HTML, just add class="ui-tabbar". P

    Get the active tab index

    -
    number getIndex ( ) 
    +
    number getIndex() 

    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_TextEnveloper.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_TextEnveloper.htm index 23ab8d3..d49981e 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_TextEnveloper.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_TextEnveloper.htm @@ -75,9 +75,10 @@ If you want to delete word block, you should press the backspace key. If you foc

    To manually create a TextEnveloper component, use the component constructor from the tau namespace.

    -
    <script>
    -var textEnveloperElement = document.getElementById("textenveloper"),
    -    textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
    +
    +<script>
    +   var textEnveloperElement = document.getElementById("textenveloper"),
    +       textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
     </script>
     
    @@ -112,8 +113,9 @@ var textEnveloperElement = document.getElementById("textenveloper"),

    To call method on component, please refer the following code:

    -
    var textEnveloperElement = document.getElementById("textenveloper"),
    -   textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
    +
    +var textEnveloperElement = document.getElementById("textenveloper"),
    +    textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
     
     textEnveloper.methodName(methodArgument1, methodArgument2, ...);
     
    @@ -131,7 +133,7 @@ textEnveloper.methodName(methodArgument1, methodArgument2, ...); -
    add ( string messages ) 
    +
    add(string messages) 

    Add message token to textenveloper.

    @@ -140,7 +142,7 @@ textEnveloper.methodName(methodArgument1, methodArgument2, ...); -
    remove ( number index ) 
    +
    remove(number index) 

    Delete token matched index.

    @@ -149,7 +151,7 @@ textEnveloper.methodName(methodArgument1, methodArgument2, ...); -
    number length (  ) 
    +
    number length() 

    Return count number of tokens.

    @@ -167,7 +169,7 @@ textEnveloper.methodName(methodArgument1, methodArgument2, ...);

    Add message token to textenveloper.

    -
    add ( string messages ) 
    +
    add(string messages) 
    @@ -215,11 +217,12 @@ textEnveloper.methodName(methodArgument1, methodArgument2, ...);

    Code example:

    <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>
     
    @@ -235,7 +238,7 @@ textEnveloper.add("hello");

    Delete token matched index.

    -
    remove ( number index ) 
    +
    remove(number index) 
    @@ -281,11 +284,12 @@ textEnveloper.add("hello");

    Code example:

    <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>
     
    @@ -301,7 +305,7 @@ textEnveloper.remove(1);

    Return count number of tokens.

    -
    number length ( ) 
    +
    number length() 
    @@ -337,15 +341,16 @@ textEnveloper.remove(1);

    Code example:

    <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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_TextInput.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_TextInput.htm index 795aa56..5f42a76 100644 --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_TextInput.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_TextInput.htm @@ -96,7 +96,7 @@ TextInput component is decorator for input elements. -
    TextInput enable (  ) 
    +
    TextInput enable() 

    Enables the TextInput

    @@ -105,7 +105,7 @@ TextInput component is decorator for input elements. -
    TextInput disable (  ) 
    +
    TextInput disable() 

    Disables the TextInput

    @@ -123,7 +123,7 @@ TextInput component is decorator for input elements.

    Enables the TextInput

    -
    TextInput enable ( ) 
    +
    TextInput enable() 
    @@ -159,10 +159,10 @@ TextInput component is decorator for input elements.

    Code example:

    <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>
    @@ -180,7 +180,7 @@ TextInput component is decorator for input elements.
     						

    Disables the TextInput

    -
    TextInput disable ( ) 
    +
    TextInput disable() 
    @@ -216,10 +216,10 @@ TextInput component is decorator for input elements.

    Code example:

    <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>
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_ToggleSwitch.htm b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_ToggleSwitch.htm
    index 60ddada..3bc2f37 100644
    --- a/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_ToggleSwitch.htm
    +++ b/org.tizen.web.apireference/html/ui_fw_api/Mobile_UIComponents/mobile_ToggleSwitch.htm
    @@ -63,8 +63,8 @@
     
     <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 />
     

    ToggleSwitch with select tag

    @@ -101,21 +101,21 @@
     			
     				
     					
    -						
    disable (  ) 
    +
    disable() 

    Disables the toggle switch.

    -
    enable (  ) 
    +
    enable() 

    Enables the toggle switch.

    -
    value (  ) 
    +
    value() 

    Gets toggleswitch state value.

    @@ -133,7 +133,7 @@

    Disables the toggle switch.

    -
    ToggleSwitch disable ( ) 
    +
    ToggleSwitch disable() 
    @@ -178,7 +178,7 @@ </select> <script>    var toggle = document.getElementById("flip-11"), -       toggleWidget = tau.widget.ToggleSwitch(toggle), +       toggleWidget = tau.widget.ToggleSwitch(toggle);    toggleWidget.disable(); </script>
    @@ -198,7 +198,7 @@

    Enables the toggle switch.

    -
    ToggleSwitch enable ( ) 
    +
    ToggleSwitch enable() 
    @@ -243,7 +243,7 @@ </select> <script>    var toggle = document.getElementById("flip-11"), -       toggleWidget = tau.widget.ToggleSwitch(toggle), +       toggleWidget = tau.widget.ToggleSwitch(toggle);    toggleWidget.enable(); </script> @@ -259,7 +259,7 @@

    Gets a value of toggle switch.

    -
    Number value ( ) 
    +
    Number value() 

    Since: diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_button.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_button.htm index 99ad5a3..419ea8f 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_button.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_button.htm @@ -55,10 +55,10 @@ And it is highly recomeneded to add these button in the content area and footer

     <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>
    @@ -134,8 +134,8 @@ And it is highly recomeneded to add these button in the content area and footer
     
     <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>
     
    @@ -143,8 +143,8 @@ And it is highly recomeneded to add these button in the content area and footer
     <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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_checkbox.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_checkbox.htm index bae85d0..a6475ee 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_checkbox.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_checkbox.htm @@ -48,7 +48,7 @@

    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:

    -<input type="radio" name="radioset" id="radio-1" />
    +<input type="radio" name="radioset" id="radio-1"/>
     <label for="radio-1">Radio</label>
     
    @@ -57,26 +57,26 @@

    To add a checkbox or radio button to a list, use the following code:

     <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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_circleprogressbar.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_circleprogressbar.htm index 44fde12..4df590b 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_circleprogressbar.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_circleprogressbar.htm @@ -46,30 +46,32 @@

    If you don't make any "circleprogress" with <progress> element, you can show default progress style.
    To add a CircleProgressBar component to the application, use the following code:

    -
    <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 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>
     
    @@ -78,29 +80,31 @@ To add a CircleProgressBar component to the application, use the following code:
    And in your javascript code, you have to add option "size: full".
    Be sure to place the <progress> element outside of content element.

    -
    <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 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>
     
    @@ -110,9 +114,10 @@ To add a CircleProgressBar component to the application, use the following code: The following shows how to use "progresschange" event.
    -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());
     });
     
    @@ -187,7 +192,7 @@ progressBar.addEventListener("progresschange", function() { -
    string value (  ) 
    +
    string value() 

    Get or Set value of the widget

    @@ -205,7 +210,7 @@ progressBar.addEventListener("progresschange", function() {

    Get or Set value of the widget

    -
    string value ( ) 
    +
    string value() 

    Since: @@ -244,29 +249,29 @@ progressBar.addEventListener("progresschange", function() {

    Code example:

    -
        
    -    <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>
    +
    +<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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_circularindexscrollbar.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_circularindexscrollbar.htm index 570b1df..1bdcb30 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_circularindexscrollbar.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_circularindexscrollbar.htm @@ -66,7 +66,7 @@

    For manual creation of circular index scroll bar, you can use constructor from tau namespace:

    var circularindexElement = document.getElementById('circularindexscrollbar'),
    -    circularindexscrollbar = tau.widget.CircularIndexScrollbar(circularindexElement, {index: "A,B,C"});
    +    circularindexscrollbar = tau.widget.CircularIndexScrollbar(circularindexElement, {index: "A,B,C"});
     

    Constructor has one require parameter element which are base HTMLElement to create component. We recommend get this element by method document.getElementById.

    @@ -74,18 +74,22 @@

    To add a circular index scroll bar component to the application, use the following code:

    -
     <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>
    +
    +<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>
     

    The index value can be retrieved by accessing event.detail.index property.

    @@ -93,84 +97,91 @@

    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:

    - <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>
     
    @@ -239,7 +250,7 @@ -
    string value (  ) 
    +
    string value() 

    Get or Set index of the circular index scroll bar

    @@ -258,7 +269,7 @@

    Get or Set index of the circular index scroll bar

    -
    string value ( ) 
    +
    string value() 
    @@ -295,15 +306,15 @@ example:

    -    <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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_drawer.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_drawer.htm index 83b4013..063587f 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_drawer.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_drawer.htm @@ -92,84 +92,91 @@ If you used the drawer handler, you must implement style code of handler. We don

    HTML

    -
       <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>
    +
    +<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>
     

    JavaScript

    -
    (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",
    -           });            
    -       }); 
    -    })();
    +
    +(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",});            
    +   }); 
    +})();

    CSS

    -#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;
    +   }   
     }
     
    @@ -229,27 +236,27 @@ If you used the drawer handler, you must implement style code of handler. We don

    Drawer positioning

    You can declare to 'position' option as below method. -
       <div class="ui-drawer" data-position="left" id="leftdrawer">
    +
    <div class="ui-drawer" data-position="left" id="leftdrawer">
     

    Drawer targeting

    You can declare to 'drawerTarget' option as below method. -
       <div class="ui-drawer" data-drawer-target="#drawerPage">
    +
    <div class="ui-drawer" data-drawer-target="#drawerPage">
     

    Drawer enable

    You can declare to 'enable' option as below method. -
       <div class="ui-drawer" data-enable="true">
    +
    <div class="ui-drawer" data-enable="true">
     

    Drawer drag gesture starting area

    You can declare to 'enable' option as below method. -
       <div class="ui-drawer" data-drag-edge="1">
    +
    <div class="ui-drawer" data-drag-edge="1">
     
    @@ -284,7 +291,7 @@ You can declare to 'enable' option as below method. -
    setDragHandler ( Element element ) 
    +
    setDragHandler(Element element) 

    Set Drawer drag handler.
    If developer use handler, drag event is bound at handler only.

    @@ -293,7 +300,7 @@ You can declare to 'enable' option as below method. -
    transition ( Integer position ) 
    +
    transition(Integer position) 

    Transition Drawer.
    This method use only positive integer number.

    @@ -302,7 +309,7 @@ You can declare to 'enable' option as below method. -
    open (  ) 
    +
    open() 

    Open Drawer.

    @@ -311,7 +318,7 @@ You can declare to 'enable' option as below method. -
    close (  ) 
    +
    close() 

    Close Drawer.

    @@ -320,7 +327,7 @@ You can declare to 'enable' option as below method. -
    String getState (  ) 
    +
    String getState() 

    Get state of Drawer.

    @@ -338,7 +345,7 @@ You can declare to 'enable' option as below method.

    Set Drawer drag handler.
    If developer use handler, drag event is bound at handler only.

    -
    setDragHandler ( Element element) 
    +
    setDragHandler(Element element) 
    @@ -346,21 +353,22 @@ You can declare to 'enable' option as below method.
    Running example in pure JavaScript:

    -<!-- 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>
    @@ -409,7 +417,7 @@ drawer.setDragHandler(handler);

    Transition Drawer.
    This method use only positive integer number.

    -
    transition ( Integer position) 
    +
    transition(Integer position) 
    @@ -417,18 +425,19 @@ drawer.setDragHandler(handler);
    Running example in pure JavaScript:
     <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>

    @@ -479,27 +488,28 @@ drawer.Transition(60);

    Open Drawer.

    -
    open ( ) 
    +
    open() 

    Running example in pure JavaScript:
    -<!-- 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>

    @@ -526,27 +536,28 @@ drawer.Transition(60);

    Close Drawer.

    -
    close ( ) 
    +
    close() 

    Running example in pure JavaScript:
    -<!-- 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>

    @@ -573,28 +584,29 @@ drawer.Transition(60);

    Get state of Drawer.

    -
    String getState ( ) 
    +
    String getState() 

    Running example in pure JavaScript:
    -<!-- 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>

    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_indexscrollbar.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_indexscrollbar.htm index bbdaf66..d71d675 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_indexscrollbar.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_indexscrollbar.htm @@ -46,8 +46,9 @@

    How to create index scroll bar

    For manual creation of Index Scroll Bar, you can use constructor from tau namespace:

    -
    var indexElement = document.getElementById('indexscrollbar'),
    -    indexscrollbar = tau.widget.IndexScrollbar(indexElement);
    +
    +var indexElement = document.getElementById('indexscrollbar'),
    +    indexscrollbar = tau.widget.IndexScrollbar(indexElement);
     

    To add an index scroll bar component to the application, use the following code:

    @@ -127,8 +128,10 @@
                    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 */
    @@ -185,10 +188,10 @@
                  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) 
              {
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_marquee.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_marquee.htm
    index eb435bc..161828e 100755
    --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_marquee.htm
    +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_marquee.htm
    @@ -59,22 +59,23 @@ It makes <div> element (has some child nodes such as text and img) move ho
     
     
     <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>
     
    @@ -184,19 +185,19 @@ It makes <div> element (has some child nodes such as text and img) move ho -
    start (  ) 
    +
    start() 

    Start Marquee animation

    -
    stop (  ) 
    +
    stop() 

    Stop Marquee animation

    -
    reset (  ) 
    +
    reset() 

    Reset Marquee animation

    @@ -213,7 +214,7 @@ It makes <div> element (has some child nodes such as text and img) move ho

    Start Marquee animation

    -
    start ( ) 
    +
    start() 
    @@ -238,11 +239,11 @@ It makes <div> element (has some child nodes such as text and img) move ho
     <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>
     
    @@ -256,7 +257,7 @@ It makes <div> element (has some child nodes such as text and img) move ho

    Stop Marquee animation

    -
    stop ( ) 
    +
    stop() 
    @@ -281,11 +282,11 @@ It makes <div> element (has some child nodes such as text and img) move ho
     <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>
     
    @@ -301,7 +302,7 @@ It makes <div> element (has some child nodes such as text and img) move ho

    Reset Marquee animation (reset and end)

    -
    reset ( ) 
    +
    reset() 
    @@ -326,11 +327,11 @@ It makes <div> element (has some child nodes such as text and img) move ho
     <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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_pageindicator.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_pageindicator.htm index ae13b96..f7d4bce 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_pageindicator.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_pageindicator.htm @@ -53,20 +53,22 @@

    For manual creation of page indicator, you can use constructor from tau namespace:

    -
    var elPageIndicator = document.getElementById("pageindicator"),
    -    pageIndicator = tau.widget.PageIndicator(elPageIndicator, { numberOfPages : 5 });
    +
    +var elPageIndicator = document.getElementById("pageindicator"),
    +    pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages : 5});
     

    Constructor has two require parameter element which are base HTMLElement to create component. We recommend get this element by method document.getElementById. Second parameter is options and it is a object with options for component. numberOfPages means the number of pages to be linked and it is mandatory.

    To add an page indicator component to the application, use the following code:

    -
     <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);
    +
    +<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>
     
    @@ -76,72 +78,77 @@
     <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>
     

    If you use the following statement when you create page indicator component, a central dot is assigned to multiple pages.

    -pageIndicator =  tau.widget.PageIndicator(elPageIndicator, { numberOfPages: 5, maxPage: 3 });
    +pageIndicator =  tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5, maxPage: 3});
     

    Options

    @@ -188,20 +195,20 @@ pageIndicator = tau.widget.PageIndicator(elPageIndicator, { numberOfPages: 5, m

    -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).
    -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 )
    +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).
    +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)
    would be indicated by the central dot, from middle of the pages.

    -So, the first dot is for the first page, and the last dot is for the fifth( the last) page.
    +So, the first dot is for the first page, and the last dot is for the fifth (the last) page.
    And the middle dot is shared by 2nd, 3rd and 4th page while scrolling pages.

    -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.
    -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.
    +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.

    Of course, the value of numberOfPages should meet the number of the pages you have added to HTML.

    -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.
    +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.
    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.

    @@ -221,7 +228,7 @@ For example, in the situation that the value of numberOfPages is "6", and the va -
    setActive ( number index ) 
    +
    setActive(number index) 

    This method sets a dot to active state.

    @@ -239,7 +246,7 @@ For example, in the situation that the value of numberOfPages is "6", and the va

    This method sets a dot to active state.

    -
    setActive ( number index) 
    +
    setActive(number index) 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_popup.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_popup.htm index c6f97b5..963b567 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_popup.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_popup.htm @@ -85,25 +85,25 @@       <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> @@ -160,12 +160,12 @@

    To bind the popup to a button, use the following code:

    -
    <!--HTML code-->
    +
    +<!--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>
    /* JavaScript code */
    @@ -221,11 +221,11 @@
     
     

    To use popup events, use the following code:

    -
    <!--Popup html code-->
    +
    +<!--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>
    /* JavaScript code */
     <script>
        /* Use popup events */
    @@ -242,32 +242,36 @@ If popup is opened or closed by only openPopup() or closePopup() method,
     it might occur exceptional errors or bugs.
    So it is highly recommended to handle the feature by using event.

    -
    <!--Popup html code-->
    +
    +<!--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>
    /* 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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_processing.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_processing.htm index 5500f8c..1228a3d 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_processing.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_processing.htm @@ -54,14 +54,15 @@ Please use the following code:

    -
    <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 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>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_sectionchanger.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_sectionchanger.htm index 6e5dc2b..72e1a58 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_sectionchanger.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_sectionchanger.htm @@ -48,7 +48,8 @@ It gets to have a virtue of needlessness of changing page and the existance of s

    How to Create Section Changer

    To add a section changer component to the application, use the following code:

    -
    <div id="hasSectionchangerPage" class="ui-page">
    +
    +<div id="hasSectionchangerPage" class="ui-page">
        <header class="ui-header">
           <h2 class="ui-title">SectionChanger</h2>
        </header>
    @@ -69,19 +70,22 @@ It gets to have a virtue of needlessness of changing page and the existance of s
     </div>
    (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();
        });
    @@ -187,21 +191,21 @@ It gets to have a virtue of needlessness of changing page and the existance of s
     
     				
     					
    -						
    setActiveSection ( number index ) 
    +
    setActiveSection(number index) 

    Changes the currently active section element (index).
    For smooth scrolling, the duration parameter must be in milliseconds.

    -
    getActiveSectionIndex () 
    +
    getActiveSectionIndex() 

    Gets the currently active section element's index.
    The return value is a number (activeIndex).

    -
    refresh () 
    +
    refresh() 

    Updates the section changer form.
    When you add new section dynamically through JavaScript, you must call the refresh() method to update section information.

    @@ -221,7 +225,7 @@ It gets to have a virtue of needlessness of changing page and the existance of s
    For smooth scrolling, the duration parameter must be in milliseconds.

    -
    setActiveSection ( number index) 
    +
    setActiveSection(number index) 
    @@ -278,7 +282,7 @@ It gets to have a virtue of needlessness of changing page and the existance of s
    The return value is a number (activeIndex).

    -
    getActiveSectionIndex () 
    +
    getActiveSectionIndex() 
    @@ -317,7 +321,7 @@ It gets to have a virtue of needlessness of changing page and the existance of s
    When you add new section dynamically through JavaScript, you must call the refresh() method to update section information.

    -
    refresh () 
    +
    refresh() 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_selector.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_selector.htm index 70a861e..7424d5d 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_selector.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_selector.htm @@ -55,43 +55,48 @@ Indicator arrow is special indicator style that has the arrow. It is used for pr

    How to Create Selector

    HTML example

    -
             <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>
    +
    +<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>
     

    Manual constructor

    -(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);
    +   });
     })();
     
    @@ -192,19 +197,19 @@ Indicator arrow is special indicator style that has the arrow. It is used for pr -
    changeItem ( Number index ) 
    +
    changeItem(Number index) 

    Change active item on active layer

    -
    addItem ( HTMLElement item, Number index ) 
    +
    addItem(HTMLElement item, Number index) 

    Add new item

    -
    removeItem ( Number index ) 
    +
    removeItem(Number index) 

    Remove item on specific layer

    @@ -219,7 +224,7 @@ Indicator arrow is special indicator style that has the arrow. It is used for pr

    Change active item on active layer

    -
    changeItem ( Number index) 
    +
    changeItem(Number index) 
    @@ -273,7 +278,7 @@ Indicator arrow is special indicator style that has the arrow. It is used for pr

    Add new item

    -
    addItem ( HTMLElement item, Number index) 
    +
    addItem(HTMLElement item, Number index) 
    @@ -335,7 +340,7 @@ Indicator arrow is special indicator style that has the arrow. It is used for pr

    Remove item on specific layer

    -
    removeItem ( Number index) 
    +
    removeItem(Number index) 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_slider.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_slider.htm index c9b15ed..959cd1c 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_slider.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_slider.htm @@ -15,14 +15,15 @@

    To add a slider component to the application, use the following code:

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

    If you want to modify the width of the slider,please change the length with width style.

    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_snaplistview.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_snaplistview.htm index 4fec0bf..1cedb5b 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_snaplistview.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_snaplistview.htm @@ -53,19 +53,21 @@ When scroll ended, it triggers "selected" event and attach class to de

    You can add a basic listview as follows:

    -
    <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 class="ui-listview ui-snap-listview" id="snapList">
    +   <li>1line</li>
    +   <li>2line</li>
    +   <li>3line</li>
    +   <li>4line</li>
    +   <li>5line</li>
     </ul>
     

    In javascript code, you can make your list as SnapListview component as follows:

    -
    <script>
    -var snapList = document.getElementById("snapList"),
    -    snapListComponent = tau.widget.SnapListview(snapList);
    +
    +<script>
    +   var snapList = document.getElementById("snapList"),
    +       snapListComponent = tau.widget.SnapListview(snapList);
     </script>
     
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_swipelist.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_swipelist.htm index d0ca3a2..bbf727c 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_swipelist.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_swipelist.htm @@ -78,18 +78,22 @@ You can set the details when swiping such as elements that appear, background co

    JavaScript

    -(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();
        });
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_toggleswitch.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_toggleswitch.htm
    index 38c81e7..b261528 100755
    --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_toggleswitch.htm
    +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_toggleswitch.htm
    @@ -28,33 +28,35 @@
     

    To add a toggle switch, you must add the ui-switch class in the <div> element. Because toggle switch is dependent on the checkbox component, you must implement the ui-switch-input class in a checkbox input element.

    To add a toggle switch component to the application, use the following code:

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

    Toggle Switch in Listview

    You can use toggle switch component in list as checkbox/radio. Please refer following code:

    -
    <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 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>
    -
    setActiveIndex ( index ) 
    +
    setActiveIndex(index) 
    @@ -202,7 +206,7 @@ ViewSwitcher component controls each view elements which are changing position.T

    Get the active view index

    -
    getActiveIndex ( ) 
    +
    getActiveIndex() 
    diff --git a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_virtuallist.htm b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_virtuallist.htm index ebf68d7..77ea724 100755 --- a/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_virtuallist.htm +++ b/org.tizen.web.apireference/html/ui_fw_api/Wearable_UIComponents/wearable_virtuallist.htm @@ -40,7 +40,8 @@
  • Insert a virtual list HTML and JSON (virtuallist-db-demo.js) code: -
    <script type="text/javascript" src="virtuallist-db-demo.js"></script>
    +
    +<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>
    /* JSON DATA example in virtuallist-db-demo.js */
     var JSON_DATA = 
    @@ -60,12 +61,14 @@ 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>';
     });
    @@ -92,7 +95,8 @@ vlist.draw();
     
     
  • When you no longer need the component, destroy it using the destroy() method:

    -page.addEventListener("pagehide", function() {
    +page.addEventListener("pagehide", function()
    +{
        vlist.destroy();
     });
     
  • diff --git a/org.tizen.web.apireference/html/w3c_api/camera_w.html b/org.tizen.web.apireference/html/w3c_api/camera_w.html index 31bc236..3cd6f4e 100644 --- a/org.tizen.web.apireference/html/w3c_api/camera_w.html +++ b/org.tizen.web.apireference/html/w3c_api/camera_w.html @@ -231,31 +231,36 @@ For audio recording, use http://tizen.org/privilege/audiorecorder privi
  • -

    Code example:

     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() {
    - }
    +

    Code example:

    +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() {}
      
    -- 2.7.4