cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [14/49] git commit: properly stop watching...
Date Mon, 05 May 2014 16:09:14 GMT
properly stop watching...


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/4d202c1f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/4d202c1f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/4d202c1f

Branch: refs/heads/cdvtest
Commit: 4d202c1f0d911c4f05469724db82eb03911f2415
Parents: 470c7c6
Author: Piotr Zalewa <piotr@zalewa.info>
Authored: Thu Oct 24 14:31:10 2013 +0200
Committer: Piotr Zalewa <piotr@zalewa.info>
Committed: Thu Oct 24 14:31:10 2013 +0200

----------------------------------------------------------------------
 src/firefoxos/accelerometer.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/4d202c1f/src/firefoxos/accelerometer.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/accelerometer.js b/src/firefoxos/accelerometer.js
index 8f33c51..b01f77c 100644
--- a/src/firefoxos/accelerometer.js
+++ b/src/firefoxos/accelerometer.js
@@ -1,15 +1,16 @@
 
+function listener function(ev) {
+    var acc = ev.accelerationIncludingGravity;
+    acc.timestamp = new Date().getTime();
+    success(acc);
+}
 var Accelerometer = {
     start: function start(success, error) {
-        return window.addEventListener('devicemotion', function(ev) {
-            var acc = ev.accelerationIncludingGravity;
-            acc.timestamp = new Date().getTime();
-            success(acc);
-        }, false);
+        return window.addEventListener('devicemotion', listener, false);
     },
 
     stop: function stop() {
-        window.removeEventListener('devicemotion');
+        window.removeEventListener('devicemotion', listener, false);
     }
 };
 


Mime
View raw message