mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-04-13 00:00:10 +08:00
@@ -1,9 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface DeviceMotionAccelerationData {
|
||||
|
||||
/**
|
||||
* Amount of acceleration on the x-axis. (in m/s^2)
|
||||
*/
|
||||
@@ -23,16 +22,13 @@ export interface DeviceMotionAccelerationData {
|
||||
* Creation timestamp in milliseconds.
|
||||
*/
|
||||
timestamp: any;
|
||||
|
||||
}
|
||||
|
||||
export interface DeviceMotionAccelerometerOptions {
|
||||
|
||||
/**
|
||||
* Requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. Default: 10000
|
||||
*/
|
||||
frequency?: number;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,11 +68,20 @@ export interface DeviceMotionAccelerometerOptions {
|
||||
plugin: 'cordova-plugin-device-motion',
|
||||
pluginRef: 'navigator.accelerometer',
|
||||
repo: 'https://github.com/apache/cordova-plugin-device-motion',
|
||||
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone 8']
|
||||
platforms: [
|
||||
'Android',
|
||||
'BlackBerry 10',
|
||||
'Browser',
|
||||
'Firefox OS',
|
||||
'iOS',
|
||||
'Tizen',
|
||||
'Ubuntu',
|
||||
'Windows',
|
||||
'Windows Phone 8'
|
||||
]
|
||||
})
|
||||
@Injectable()
|
||||
export class DeviceMotion extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Get the current acceleration along the x, y, and z axes.
|
||||
* @returns {Promise<DeviceMotionAccelerationData>} Returns object with x, y, z, and timestamp properties
|
||||
@@ -96,8 +101,9 @@ export class DeviceMotion extends IonicNativePlugin {
|
||||
observable: true,
|
||||
clearFunction: 'clearWatch'
|
||||
})
|
||||
watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable<DeviceMotionAccelerationData> {
|
||||
watchAcceleration(
|
||||
options?: DeviceMotionAccelerometerOptions
|
||||
): Observable<DeviceMotionAccelerationData> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user