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/10/25 01:43:53 UTC

[1/2] git commit: orientation plugin

Updated Branches:
  refs/heads/dev adac39198 -> 5053698d5


orientation plugin


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/ac6b46c4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/tree/ac6b46c4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/diff/ac6b46c4

Branch: refs/heads/dev
Commit: ac6b46c4a161c2479b02b830a9a24c59e01062f7
Parents: 1870cd9
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Thu Oct 24 14:23:35 2013 +0200
Committer: Piotr Zalewa <pi...@zalewa.info>
Committed: Thu Oct 24 14:23:35 2013 +0200

----------------------------------------------------------------------
 plugin.xml               | 13 +++++++++++++
 src/firefoxos/compass.js | 23 +++++++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/ac6b46c4/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index f82b98c..e6389c3 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -22,6 +22,19 @@
         <clobbers target="navigator.compass" />
     </js-module>
 
+    <!-- firefoxos -->
+    <platform name="firefoxos">
+        <config-file target="config.xml" parent="/*">
+            <feature name="Compass">
+                <param name="firefoxos-package" value="Compass" />
+            </feature>
+        </config-file>                                         
+        
+        <js-module src="src/firefoxos/compass.js" name="compass-impl">
+          <runs />
+        </js-module>
+    </platform>
+
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/ac6b46c4/src/firefoxos/compass.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/compass.js b/src/firefoxos/compass.js
new file mode 100644
index 0000000..53ad72c
--- /dev/null
+++ b/src/firefoxos/compass.js
@@ -0,0 +1,23 @@
+
+var Compass = {
+    getHeading: function(success, error) {
+        var listener = function(ev) {
+            var orient = {
+                trueHeading: ev.alpha,
+                magneticHeading: ev.alpha,
+                headingAccuracy: 0,
+                timestamp: new Date().getTime()
+            }
+            success(orient);
+            // remove listener after first response
+            window.removeEventListener('deviceorientation', listener, false);
+        }
+        return window.addEventListener('deviceorientation', listener, false);
+    },
+};
+
+var firefoxos = require('cordova/platform');
+
+module.exports = Compass;
+require('cordova/firefoxos/commandProxy').add('Compass', Compass);
+


[2/2] git commit: Merge branch 'master' of github.com:zalun/cordova-plugin-device-orientation into dev

Posted by st...@apache.org.
Merge branch 'master' of github.com:zalun/cordova-plugin-device-orientation into dev


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/5053698d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/tree/5053698d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/diff/5053698d

Branch: refs/heads/dev
Commit: 5053698d5f3f24b8562a14c419c311c3f64e587b
Parents: adac391 ac6b46c
Author: Steven Gill <st...@gmail.com>
Authored: Thu Oct 24 14:55:37 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu Oct 24 14:55:37 2013 -0700

----------------------------------------------------------------------
 plugin.xml               | 13 +++++++++++++
 src/firefoxos/compass.js | 23 +++++++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/5053698d/plugin.xml
----------------------------------------------------------------------