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 2015/03/14 03:12:08 UTC

cordova-plugin-device-motion git commit: CB-8653 Updated Readme

Repository: cordova-plugin-device-motion
Updated Branches:
  refs/heads/master 7677729d4 -> a943b4c1f


CB-8653 Updated Readme


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

Branch: refs/heads/master
Commit: a943b4c1f160e78d67ae49b5e192597b093d3f7a
Parents: 7677729
Author: Steve Gill <st...@gmail.com>
Authored: Fri Mar 13 19:11:59 2015 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Mar 13 19:11:59 2015 -0700

----------------------------------------------------------------------
 README.md    | 153 +++++++++++++++++++++++++++++++++++++++++++++++-
 doc/index.md | 171 ------------------------------------------------------
 2 files changed, 151 insertions(+), 173 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/a943b4c1/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 4f21cc5..91bf510 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,157 @@
          under the License.
 -->
 
-# org.apache.cordova.device-motion
+# cordova-plugin-device-motion
 
 [![Build Status](https://travis-ci.org/apache/cordova-plugin-device-motion.svg)](https://travis-ci.org/apache/cordova-plugin-device-motion)
 
-Plugin documentation: [doc/index.md](doc/index.md)
+This plugin provides access to the device's accelerometer. The accelerometer is
+a motion sensor that detects the change (_delta_) in movement relative to the
+current device orientation, in three dimensions along the _x_, _y_, and _z_
+axis.
+
+Access is via a global `navigator.accelerometer` object.
+
+Although the object is attached to the global scoped `navigator`, it is not available until after the `deviceready` event.
+
+    document.addEventListener("deviceready", onDeviceReady, false);
+    function onDeviceReady() {
+        console.log(navigator.accelerometer);
+    }
+
+## Installation
+
+    cordova plugin add cordova-plugin-device-motion
+
+## Supported Platforms
+
+- Amazon Fire OS
+- Android
+- BlackBerry 10
+- Browser
+- Firefox OS
+- iOS
+- Tizen
+- Windows Phone 8
+- Windows
+
+## Methods
+
+- navigator.accelerometer.getCurrentAcceleration
+- navigator.accelerometer.watchAcceleration
+- navigator.accelerometer.clearWatch
+
+## Objects
+
+- Acceleration
+
+## navigator.accelerometer.getCurrentAcceleration
+
+Get the current acceleration along the _x_, _y_, and _z_ axes.
+
+These acceleration values are returned to the `accelerometerSuccess`
+callback function.
+
+    navigator.accelerometer.getCurrentAcceleration(accelerometerSuccess, accelerometerError);
+
+
+### Example
+
+    function onSuccess(acceleration) {
+        alert('Acceleration X: ' + acceleration.x + '\n' +
+              'Acceleration Y: ' + acceleration.y + '\n' +
+              'Acceleration Z: ' + acceleration.z + '\n' +
+              'Timestamp: '      + acceleration.timestamp + '\n');
+    };
+
+    function onError() {
+        alert('onError!');
+    };
+
+    navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
+
+### Browser Quirks
+
+Values for X, Y, Z motion are all randomly generated in order to simulate the accelerometer.
+
+### iOS Quirks
+
+- iOS doesn't recognize the concept of getting the current acceleration at any given point.
+
+- You must watch the acceleration and capture the data at given time intervals.
+
+- Thus, the `getCurrentAcceleration` function yields the last value reported from a `watchAccelerometer` call.
+
+## navigator.accelerometer.watchAcceleration
+
+Retrieves the device's current `Acceleration` at a regular interval, executing
+the `accelerometerSuccess` callback function each time. Specify the interval in
+milliseconds via the `acceleratorOptions` object's `frequency` parameter.
+
+The returned watch ID references the accelerometer's watch interval,
+and can be used with `navigator.accelerometer.clearWatch` to stop watching the
+accelerometer.
+
+    var watchID = navigator.accelerometer.watchAcceleration(accelerometerSuccess,
+                                                           accelerometerError,
+                                                           accelerometerOptions);
+
+- __accelerometerOptions__: An object with the following optional keys:
+  - __period__: requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. _(Number)_ (Default: 10000)
+
+
+###  Example
+
+    function onSuccess(acceleration) {
+        alert('Acceleration X: ' + acceleration.x + '\n' +
+              'Acceleration Y: ' + acceleration.y + '\n' +
+              'Acceleration Z: ' + acceleration.z + '\n' +
+              'Timestamp: '      + acceleration.timestamp + '\n');
+    };
+
+    function onError() {
+        alert('onError!');
+    };
+
+    var options = { frequency: 3000 };  // Update every 3 seconds
+
+    var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+
+### iOS Quirks
+
+The API calls the success callback function at the interval requested,
+but restricts the range of requests to the device between 40ms and
+1000ms. For example, if you request an interval of 3 seconds,
+(3000ms), the API requests data from the device every 1 second, but
+only executes the success callback every 3 seconds.
+
+## navigator.accelerometer.clearWatch
+
+Stop watching the `Acceleration` referenced by the `watchID` parameter.
+
+    navigator.accelerometer.clearWatch(watchID);
+
+- __watchID__: The ID returned by `navigator.accelerometer.watchAcceleration`.
+
+###  Example
+
+    var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+
+    // ... later on ...
+
+    navigator.accelerometer.clearWatch(watchID);
+
+## Acceleration
+
+Contains `Accelerometer` data captured at a specific point in time.
+Acceleration values include the effect of gravity (9.81 m/s^2), so that when a
+device lies flat and facing up, _x_, _y_, and _z_ values returned should be
+`0`, `0`, and `9.81`.
+
+### Properties
+
+- __x__:  Amount of acceleration on the x-axis. (in m/s^2) _(Number)_
+- __y__:  Amount of acceleration on the y-axis. (in m/s^2) _(Number)_
+- __z__:  Amount of acceleration on the z-axis. (in m/s^2) _(Number)_
+- __timestamp__: Creation timestamp in milliseconds. _(DOMTimeStamp)_
+

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/a943b4c1/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
deleted file mode 100644
index 2760621..0000000
--- a/doc/index.md
+++ /dev/null
@@ -1,171 +0,0 @@
-<!---
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-
-# org.apache.cordova.device-motion
-
-This plugin provides access to the device's accelerometer. The accelerometer is
-a motion sensor that detects the change (_delta_) in movement relative to the
-current device orientation, in three dimensions along the _x_, _y_, and _z_
-axis.
-
-Access is via a global `navigator.accelerometer` object.
-
-Although the object is attached to the global scoped `navigator`, it is not available until after the `deviceready` event.
-
-    document.addEventListener("deviceready", onDeviceReady, false);
-    function onDeviceReady() {
-        console.log(navigator.accelerometer);
-    }
-
-## Installation
-
-    cordova plugin add org.apache.cordova.device-motion
-
-## Supported Platforms
-
-- Amazon Fire OS
-- Android
-- BlackBerry 10
-- Browser
-- Firefox OS
-- iOS
-- Tizen
-- Windows Phone 8
-- Windows
-
-## Methods
-
-- navigator.accelerometer.getCurrentAcceleration
-- navigator.accelerometer.watchAcceleration
-- navigator.accelerometer.clearWatch
-
-## Objects
-
-- Acceleration
-
-## navigator.accelerometer.getCurrentAcceleration
-
-Get the current acceleration along the _x_, _y_, and _z_ axes.
-
-These acceleration values are returned to the `accelerometerSuccess`
-callback function.
-
-    navigator.accelerometer.getCurrentAcceleration(accelerometerSuccess, accelerometerError);
-
-
-### Example
-
-    function onSuccess(acceleration) {
-        alert('Acceleration X: ' + acceleration.x + '\n' +
-              'Acceleration Y: ' + acceleration.y + '\n' +
-              'Acceleration Z: ' + acceleration.z + '\n' +
-              'Timestamp: '      + acceleration.timestamp + '\n');
-    };
-
-    function onError() {
-        alert('onError!');
-    };
-
-    navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
-
-### Browser Quirks
-
-Values for X, Y, Z motion are all randomly generated in order to simulate the accelerometer.
-
-### iOS Quirks
-
-- iOS doesn't recognize the concept of getting the current acceleration at any given point.
-
-- You must watch the acceleration and capture the data at given time intervals.
-
-- Thus, the `getCurrentAcceleration` function yields the last value reported from a `watchAccelerometer` call.
-
-## navigator.accelerometer.watchAcceleration
-
-Retrieves the device's current `Acceleration` at a regular interval, executing
-the `accelerometerSuccess` callback function each time. Specify the interval in
-milliseconds via the `acceleratorOptions` object's `frequency` parameter.
-
-The returned watch ID references the accelerometer's watch interval,
-and can be used with `navigator.accelerometer.clearWatch` to stop watching the
-accelerometer.
-
-    var watchID = navigator.accelerometer.watchAcceleration(accelerometerSuccess,
-                                                           accelerometerError,
-                                                           accelerometerOptions);
-
-- __accelerometerOptions__: An object with the following optional keys:
-  - __period__: requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. _(Number)_ (Default: 10000)
-
-
-###  Example
-
-    function onSuccess(acceleration) {
-        alert('Acceleration X: ' + acceleration.x + '\n' +
-              'Acceleration Y: ' + acceleration.y + '\n' +
-              'Acceleration Z: ' + acceleration.z + '\n' +
-              'Timestamp: '      + acceleration.timestamp + '\n');
-    };
-
-    function onError() {
-        alert('onError!');
-    };
-
-    var options = { frequency: 3000 };  // Update every 3 seconds
-
-    var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
-
-### iOS Quirks
-
-The API calls the success callback function at the interval requested,
-but restricts the range of requests to the device between 40ms and
-1000ms. For example, if you request an interval of 3 seconds,
-(3000ms), the API requests data from the device every 1 second, but
-only executes the success callback every 3 seconds.
-
-## navigator.accelerometer.clearWatch
-
-Stop watching the `Acceleration` referenced by the `watchID` parameter.
-
-    navigator.accelerometer.clearWatch(watchID);
-
-- __watchID__: The ID returned by `navigator.accelerometer.watchAcceleration`.
-
-###  Example
-
-    var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
-
-    // ... later on ...
-
-    navigator.accelerometer.clearWatch(watchID);
-
-## Acceleration
-
-Contains `Accelerometer` data captured at a specific point in time.
-Acceleration values include the effect of gravity (9.81 m/s^2), so that when a
-device lies flat and facing up, _x_, _y_, and _z_ values returned should be
-`0`, `0`, and `9.81`.
-
-### Properties
-
-- __x__:  Amount of acceleration on the x-axis. (in m/s^2) _(Number)_
-- __y__:  Amount of acceleration on the y-axis. (in m/s^2) _(Number)_
-- __z__:  Amount of acceleration on the z-axis. (in m/s^2) _(Number)_
-- __timestamp__: Creation timestamp in milliseconds. _(DOMTimeStamp)_
-


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org