awesome-cordova-plugins/src/plugins/vibration.ts

45 lines
1.1 KiB
TypeScript
Raw Normal View History

2016-07-18 02:22:30 +08:00
import { Cordova, Plugin } from './plugin';
2016-03-14 03:53:03 +08:00
/**
* @name Vibration
* @description Vibrates the device
* @usage
* ```typescript
* import { Vibration } from 'ionic-native';
*
*
2016-03-14 03:53:03 +08:00
* // Vibrate the device for a second
* // Duration is ignored on iOS.
2016-03-14 03:53:03 +08:00
* Vibration.vibrate(1000);
*
* // Vibrate 2 seconds
* // Pause for 1 second
* // Vibrate for 2 seconds
* // Patterns work on Android and Windows only
* Vibration.vibrate([2000,1000,2000]);
*
* // Stop any current vibrations immediately
* // Works on Android and Windows only
* Vibration.vibrate(0);
* ```
*/
@Plugin({
plugin: 'cordova-plugin-vibration',
pluginRef: 'navigator',
2016-06-11 22:38:55 +08:00
repo: 'https://github.com/apache/cordova-plugin-vibration',
platforms: ['Android', 'iOS', 'Windows 8.1 Phone', 'Windows 8.1', 'Windows 10']
2016-03-14 03:53:03 +08:00
})
export class Vibration {
/**
* Vibrates the device for given amount of time.
2016-06-11 22:38:55 +08:00
* @param time {number|Array<number>} Milliseconds to vibrate the device. If passed an array of numbers, it will define a vibration pattern. Pass 0 to stop any vibration immediately.
2016-03-14 03:53:03 +08:00
*/
@Cordova({
sync: true
})
2016-07-18 02:22:30 +08:00
static vibrate(time: number | Array<number>) { }
2016-03-14 03:53:03 +08:00
2016-07-18 02:22:30 +08:00
}