From ffa37e2932e459bd0eb960df35bb1b8662e89c1d Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Tue, 28 Mar 2017 06:49:32 -0400 Subject: [PATCH] feat(taptic-engine): add taptic engine plugin support (#1271) * Added taptic plugin. #571 * docs(taptic): improve docs * update to v3 --- .../plugins/taptic-engine/index.ts | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/@ionic-native/plugins/taptic-engine/index.ts diff --git a/src/@ionic-native/plugins/taptic-engine/index.ts b/src/@ionic-native/plugins/taptic-engine/index.ts new file mode 100644 index 000000000..717bc9bb6 --- /dev/null +++ b/src/@ionic-native/plugins/taptic-engine/index.ts @@ -0,0 +1,62 @@ +import { Cordova, Plugin } from '@ionic-native/core'; +import { Injectable } from '@angular/core'; + +/** + * @name Taptic Engine + * @description + * An Ionic plugin to use Taptic Engine API on iPHone 7, 7 Plus or newer. + * + * @usage + * ```ts + * import { TapticEngine } from '@ionic-native/taptic-engine; + * + * ... + * + * constructor(private taptic: TapticEngine) { } + * + * ... + * + * this.taptic.selection(); + * + * this.taptic.notification(); + * + * this.taptic.impact(); + * + * ``` + */ +@Plugin({ + pluginName: 'TapticEngine', + plugin: 'cordova-plugin-taptic-engine', + pluginRef: 'TapticEngine', + repo: 'https://github.com/EddyVerbruggen/cordova-plugin-taptic-engine', + platforms: ['iOS'] +}) +@Injectable() +export class TapticEngine { + + /** + * Use selection feedback generators to indicate a change in selection. + * @returns {Promise} Returns a promise that resolves on success and rejects on error + */ + @Cordova() + selection(): Promise { return; } + + /** + * Use this to indicate success/failure/warning to the user. + * @param options {Object} should be of the type { type: 'success' } (or 'warning'/'error') + * @param options.type {string} + * @returns {Promise} Returns a promise that resolves on success and rejects on error + */ + @Cordova() + notification(options: { type: string }): Promise { return; } + + /** + * Use this to indicate success/failure/warning to the user. + * @param options {Object} should be of the type { style: 'light' } (or 'medium'/'heavy') + * @param options.type {string} + * @returns {Promise} Returns a promise that resolves on success and rejects on error + */ + @Cordova() + impact(options: { style: string }): Promise { return; } + +}