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/09/27 00:25:07 UTC
[4/9] git commit: [CB-4900] Windows 8 Compass plugin have extra
define breaks plugin loading
[CB-4900] Windows 8 Compass plugin have extra define breaks plugin loading
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/35d45d40
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/tree/35d45d40
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/diff/35d45d40
Branch: refs/heads/master
Commit: 35d45d40d7c71099990e252271e27205fe5685d4
Parents: b98dd17
Author: Carlos Santana <cs...@gmail.com>
Authored: Tue Sep 24 15:19:29 2013 -0400
Committer: Carlos Santana <cs...@gmail.com>
Committed: Tue Sep 24 15:19:29 2013 -0400
----------------------------------------------------------------------
src/windows8/CompassProxy.js | 45 +++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/35d45d40/src/windows8/CompassProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/CompassProxy.js b/src/windows8/CompassProxy.js
index 65ba649..f93fa2b 100644
--- a/src/windows8/CompassProxy.js
+++ b/src/windows8/CompassProxy.js
@@ -1,4 +1,4 @@
-cordova.define("org.apache.cordova.core.device-orientation.CompassProxy", function(require, exports, module) {/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,44 +19,43 @@ cordova.define("org.apache.cordova.core.device-orientation.CompassProxy", functi
*
*/
-/*global Windows:true */
+/*jslint sloppy:true */
+/*global Windows:true, require, module, setTimeout */
var cordova = require('cordova'),
CompassHeading = require('org.apache.cordova.core.device-orientation.CompassHeading'),
- CompassError = require('org.apache.cordova.core.device-orientation.CompassError')
+ CompassError = require('org.apache.cordova.core.device-orientation.CompassError');
module.exports = {
- onReadingChanged:null,
- getHeading:function(win,lose) {
+ onReadingChanged: null,
+ getHeading: function (win, lose) {
var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
- if(!deviceCompass) {
- setTimeout(function(){
+ if (!deviceCompass) {
+ setTimeout(function () {
lose(CompassError.COMPASS_NOT_SUPPORTED);
- },0);
- }
- else {
+ }, 0);
+ } else {
- deviceCompass.reportInterval = Math.max(16,deviceCompass.minimumReportInterval);
+ deviceCompass.reportInterval = Math.max(16, deviceCompass.minimumReportInterval);
- this.onReadingChanged = function(e) {
- var reading = e.reading;
- var heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth,null,reading.timestamp);
+ this.onReadingChanged = function (e) {
+ var reading = e.reading,
+ heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth, null, reading.timestamp);
win(heading);
};
- deviceCompass.addEventListener("readingchanged",this.onReadingChanged);
+ deviceCompass.addEventListener("readingchanged", this.onReadingChanged);
}
},
- stopHeading:function(win,lose) {
+ stopHeading: function (win, lose) {
var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
- if(!deviceCompass) {
- setTimeout(function(){
+ if (!deviceCompass) {
+ setTimeout(function () {
lose(CompassError.COMPASS_NOT_SUPPORTED);
- },0);
- }
- else {
- deviceCompass.removeEventListener("readingchanged",this.onReadingChanged);
+ }, 0);
+ } else {
+ deviceCompass.removeEventListener("readingchanged", this.onReadingChanged);
this.onReadingChanged = null;
deviceCompass.reportInterval = 0;
win();
@@ -65,4 +64,4 @@ module.exports = {
}
};
-require("cordova/windows8/commandProxy").add("Compass",module.exports);});
+require("cordova/windows8/commandProxy").add("Compass", module.exports);