cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject git commit: [windows8] require/use CompassError
Date Mon, 19 Aug 2013 21:15:41 GMT
Updated Branches:
  refs/heads/dev 8477e4b1a -> 1aec35e55


[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/dev
Commit: 1aec35e55ced981cfad0ebfc3bf81729144c214b
Parents: 8477e4b
Author: purplecabbage <purplecabbage@gmail.com>
Authored: Mon Aug 19 14:15:19 2013 -0700
Committer: purplecabbage <purplecabbage@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;


Mime
View raw message