mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-17 00:51:07 +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 { Cordova, Plugin } from './plugin';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
export interface AccelerationData {
|
export interface DeviceMotionAccelerationData {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount of acceleration on the x-axis. (in m/s^2)
|
* 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
|
* Requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. Default: 10000
|
||||||
@ -59,6 +59,9 @@ export interface AccelerometerOptions {
|
|||||||
* subscription.unsubscribe();
|
* subscription.unsubscribe();
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
|
* @interfaces
|
||||||
|
* DeviceMotionAccelerationData
|
||||||
|
* DeviceMotionAccelerometerOptions
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
pluginName: 'DeviceMotion',
|
pluginName: 'DeviceMotion',
|
||||||
@ -70,21 +73,21 @@ export class DeviceMotion {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current acceleration along the x, y, and z axes.
|
* 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()
|
@Cordova()
|
||||||
static getCurrentAcceleration(): Promise<AccelerationData> { return; }
|
static getCurrentAcceleration(): Promise<DeviceMotionAccelerationData> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
|
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
|
||||||
* @param {AccelerometerOptions} options list of options for the accelerometer.
|
* @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({
|
@Cordova({
|
||||||
callbackOrder: 'reverse',
|
callbackOrder: 'reverse',
|
||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'clearWatch'
|
clearFunction: 'clearWatch'
|
||||||
})
|
})
|
||||||
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> { return; }
|
static watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable<DeviceMotionAccelerationData> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user