mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-01 02:53:03 +08:00
refractor(device-motion): refractor interfaces to avoid duplicates
This commit is contained in:
parent
2a98be594a
commit
a693740f1a
@ -1,7 +1,7 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export interface AccelerationData {
|
||||
export interface DeviceMotionAccelerationData {
|
||||
|
||||
/**
|
||||
* Amount of acceleration on the x-axis. (in m/s^2)
|
||||
@ -25,7 +25,7 @@ export interface AccelerationData {
|
||||
|
||||
}
|
||||
|
||||
export interface AccelerometerOptions {
|
||||
export interface DeviceMotionAccelerometerOptions {
|
||||
|
||||
/**
|
||||
* Requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. Default: 10000
|
||||
@ -59,6 +59,9 @@ export interface AccelerometerOptions {
|
||||
* subscription.unsubscribe();
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* DeviceMotionAccelerationData
|
||||
* DeviceMotionAccelerometerOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'DeviceMotion',
|
||||
@ -70,21 +73,21 @@ export class DeviceMotion {
|
||||
|
||||
/**
|
||||
* Get the current acceleration along the x, y, and z axes.
|
||||
* @returns {Promise<AccelerationData>} Returns object with x, y, z, and timestamp properties
|
||||
* @returns {Promise<DeviceMotionAccelerationData>} Returns object with x, y, z, and timestamp properties
|
||||
*/
|
||||
@Cordova()
|
||||
static getCurrentAcceleration(): Promise<AccelerationData> { return; }
|
||||
static getCurrentAcceleration(): Promise<DeviceMotionAccelerationData> { return; }
|
||||
|
||||
/**
|
||||
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
|
||||
* @param {AccelerometerOptions} options list of options for the accelerometer.
|
||||
* @returns {Observable<AccelerationData>} Observable returns an observable that you can subscribe to
|
||||
* @returns {Observable<DeviceMotionAccelerationData>} Observable returns an observable that you can subscribe to
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse',
|
||||
observable: true,
|
||||
clearFunction: 'clearWatch'
|
||||
})
|
||||
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> { return; }
|
||||
static watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable<DeviceMotionAccelerationData> { return; }
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user