You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2015/10/30 19:48:26 UTC
[2/3] cordova-plugin-device-motion git commit: access all accel
properties via getters
access all accel properties via getters
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/1f4689cf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/1f4689cf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/1f4689cf
Branch: refs/heads/master
Commit: 1f4689cffbcae05e1983af34a7f257fe9039fc65
Parents: 6b636a7
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Oct 30 11:46:10 2015 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Oct 30 11:46:10 2015 -0700
----------------------------------------------------------------------
src/ios/CDVAccelerometer.m | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/1f4689cf/src/ios/CDVAccelerometer.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVAccelerometer.m b/src/ios/CDVAccelerometer.m
index b2ef65f..476de04 100755
--- a/src/ios/CDVAccelerometer.m
+++ b/src/ios/CDVAccelerometer.m
@@ -43,10 +43,10 @@
{
self = [super init];
if (self) {
- x = 0;
- y = 0;
- z = 0;
- timestamp = 0;
+ self.x = 0;
+ self.y = 0;
+ self.z = 0;
+ self.timestamp = 0;
self.callbackId = nil;
self.isRunning = NO;
self.haveReturnedResult = YES;
@@ -118,10 +118,10 @@
// Create an acceleration object
NSMutableDictionary* accelProps = [NSMutableDictionary dictionaryWithCapacity:4];
- [accelProps setValue:[NSNumber numberWithDouble:x * kGravitationalConstant] forKey:@"x"];
- [accelProps setValue:[NSNumber numberWithDouble:y * kGravitationalConstant] forKey:@"y"];
- [accelProps setValue:[NSNumber numberWithDouble:z * kGravitationalConstant] forKey:@"z"];
- [accelProps setValue:[NSNumber numberWithDouble:timestamp] forKey:@"timestamp"];
+ [accelProps setValue:[NSNumber numberWithDouble:self.x * kGravitationalConstant] forKey:@"x"];
+ [accelProps setValue:[NSNumber numberWithDouble:self.y * kGravitationalConstant] forKey:@"y"];
+ [accelProps setValue:[NSNumber numberWithDouble:self.z * kGravitationalConstant] forKey:@"z"];
+ [accelProps setValue:[NSNumber numberWithDouble:self.timestamp] forKey:@"timestamp"];
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:accelProps];
[result setKeepCallback:[NSNumber numberWithBool:YES]];
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org