incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [10/10] js commit: only call success when running + we have retrieved a value at least once.
Date Wed, 18 Jul 2012 21:05:45 GMT
only call success when running + we have retrieved a value at least once.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/1dabf248
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/1dabf248
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/1dabf248

Branch: refs/heads/master
Commit: 1dabf248f1b8a23252dd28ac092ba1e80330a0dd
Parents: 3d0790c
Author: Jesse <purplecabbage@gmail.com>
Authored: Sun Jul 15 02:59:42 2012 -0700
Committer: Jesse <purplecabbage@gmail.com>
Committed: Sun Jul 15 02:59:42 2012 -0700

----------------------------------------------------------------------
 lib/common/plugin/accelerometer.js |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/1dabf248/lib/common/plugin/accelerometer.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/accelerometer.js b/lib/common/plugin/accelerometer.js
index f343902..e27c92b 100644
--- a/lib/common/plugin/accelerometer.js
+++ b/lib/common/plugin/accelerometer.js
@@ -126,7 +126,10 @@ var accelerometer = {
 
         if (running) {
             // If we're already running then immediately invoke the success callback
-            successCallback(accel);
+            // but only if we have retreived a value, sample code does not check for null
...
+            if(accel) {
+                successCallback(accel);
+            }
         } else {
             start();
         }


Mime
View raw message