awesome-cordova-plugins/src/@ionic-native/plugins/device-feedback/index.ts
Daniel Sogl c6f9fa356f style(): unify docs and spacing (#1448)
* typo(barcode-scanner): fixe circle lint error

* typo(docs):  Unified the documentations

In some plugins the typescript markup was missing.
I also unified the console.log string from console.log("hello") to console.log('Hello') so any plugin page look the same.
2017-04-30 14:36:22 -04:00

64 lines
1.7 KiB
TypeScript

import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @name Device Feedback
* @description
*
* Plugin that lets you provide haptic or acoustic feedback on Android devices.
*
* @usage
* ```typescript
* import { DeviceFeedback } from '@ionic-native/device-feedback';
*
* constructor(private deviceFeedback: DeviceFeedback) { }
*
* ...
*
*
* this.deviceFeedback.acoustic();
*
* this.deviceFeedback.haptic(0);
*
* this.deviceFeedback.isFeedbackEnabled()
* .then((feedback) => {
* console.log(feedback);
* // {
* // acoustic: true,
* // haptic: true
* // }
* });
*
* ```
*/
@Plugin({
pluginName: 'DeviceFeedback',
plugin: 'cordova-plugin-velda-devicefeedback',
pluginRef: 'plugins.deviceFeedback',
repo: 'https://github.com/VVelda/device-feedback',
platforms: ['Android']
})
@Injectable()
export class DeviceFeedback extends IonicNativePlugin {
/**
* Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do.
*/
@Cordova({ sync: true })
acoustic(): void { }
/**
* Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do.
* @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.
*/
@Cordova({ sync: true })
haptic(type: number): void { }
/**
* Check if haptic and acoustic feedback is enabled by user settings.
* @returns {Promise<any>}
*/
@Cordova()
isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; }
}