2016-08-16 12:53:15 +08:00
|
|
|
import { Plugin, Cordova } from './plugin';
|
2016-09-10 03:45:24 +08:00
|
|
|
import { Observable } from '@reactivex/rxjs';
|
2016-08-15 15:58:34 +08:00
|
|
|
/**
|
|
|
|
* @name Shake
|
|
|
|
* @description Handles shake gesture
|
|
|
|
* @usage
|
|
|
|
* ```typescript
|
|
|
|
* import {Shake} from 'ionic-native';
|
|
|
|
*
|
|
|
|
* let watch = Shake.startWatch(60).subscribe(() => {
|
|
|
|
* // do something
|
|
|
|
* });
|
|
|
|
*
|
|
|
|
* watch.unsubscribe();
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
@Plugin({
|
|
|
|
plugin: 'cordova-plugin-shake',
|
|
|
|
pluginRef: 'shake',
|
|
|
|
repo: 'https://github.com/leecrossley/cordova-plugin-shake'
|
|
|
|
})
|
|
|
|
export class Shake {
|
|
|
|
/**
|
|
|
|
* Watch for shake gesture
|
|
|
|
* @param sensitivity {number} Optional sensitivity parameter. Defaults to 40
|
|
|
|
*/
|
|
|
|
@Cordova({
|
|
|
|
observable: true,
|
|
|
|
clearFunction: 'stopWatch',
|
|
|
|
successIndex: 0,
|
|
|
|
errorIndex: 2
|
|
|
|
})
|
|
|
|
static startWatch(sensitivity?: number): Observable<any> {return; }
|
|
|
|
|
|
|
|
}
|