Skip to content

Commit

Permalink
feat(shake): add Shake plugin (#426)
Browse files Browse the repository at this point in the history
closes #313
  • Loading branch information
ihadeed committed Aug 15, 2016
1 parent 8cd6686 commit 203d4c7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import {Push} from './plugins/push';
import {SafariViewController} from './plugins/safari-view-controller';
import {Screenshot} from './plugins/screenshot';
import {SecureStorage} from './plugins/securestorage';
import {Shake} from './plugins/shake';
import {Sim} from './plugins/sim';
import {SMS} from './plugins/sms';
import {SocialSharing} from './plugins/socialsharing';
Expand Down Expand Up @@ -156,6 +157,7 @@ export {
PinDialog,
Screenshot,
SecureStorage,
Shake,
SocialSharing,
Sim,
Splashscreen,
Expand Down Expand Up @@ -234,6 +236,7 @@ window['IonicNative'] = {
SafariViewController: SafariViewController,
Screenshot: Screenshot,
SecureStorage: SecureStorage,
Shake: Shake,
Sim: Sim,
SMS: SMS,
SocialSharing: SocialSharing,
Expand Down
35 changes: 35 additions & 0 deletions src/plugins/shake.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
/**
* @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; }

}

0 comments on commit 203d4c7

Please sign in to comment.