You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/08/19 23:41:44 UTC

[7/9] git commit: [windows8] require/use CompassError

[windows8] require/use CompassError


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/commit/1aec35e5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/tree/1aec35e5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/diff/1aec35e5

Branch: refs/heads/master
Commit: 1aec35e55ced981cfad0ebfc3bf81729144c214b
Parents: 8477e4b
Author: purplecabbage <pu...@gmail.com>
Authored: Mon Aug 19 14:15:19 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Mon Aug 19 14:15:19 2013 -0700

----------------------------------------------------------------------
 src/windows8/CompassProxy.js | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/1aec35e5/src/windows8/CompassProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/CompassProxy.js b/src/windows8/CompassProxy.js
index aa94b88..6546939 100644
--- a/src/windows8/CompassProxy.js
+++ b/src/windows8/CompassProxy.js
@@ -22,7 +22,8 @@
 /*global Windows:true */
 
 var cordova = require('cordova'),
-    CompassHeading = require('org.apache.cordova.core.device-orientation.CompassHeading');
+    CompassHeading = require('org.apache.cordova.core.device-orientation.CompassHeading'),
+    CompassError = require('org.apache.cordova.core.device-orientation.CompassError')
 
 
 module.exports = {
@@ -31,7 +32,9 @@ module.exports = {
     getHeading:function(win,lose) {
         var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
         if(!deviceCompass) {
-            setTimeout(function(){lose("Compass not available");},0);
+            setTimeout(function(){
+                lose(new CompassError(CompassError.COMPASS_NOT_SUPPORTED));
+            },0);
         }
         else {
 
@@ -49,10 +52,11 @@ module.exports = {
     stopHeading:function(win,lose) {
         var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
         if(!deviceCompass) {
-            setTimeout(function(){lose("Compass not available");},0);
+            setTimeout(function(){
+                lose(new CompassError(CompassError.COMPASS_NOT_SUPPORTED));
+            },0);
         }
         else {
-
             deviceCompass.removeEventListener("readingchanged",this.onReadingChanged);
             this.onReadingChanged = null;
             deviceCompass.reportInterval = 0;