94 lines
2.4 KiB
TypeScript
Raw Normal View History

2017-12-28 07:28:44 -05:00
import { Cordova, IonicNativePlugin, 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
* ```typescript
2018-10-10 16:13:45 -05:00
* import { TapticEngine } from '@ionic-native/taptic-engine/ngx';
*
* ...
*
* 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 extends IonicNativePlugin {
/**
* Use selection feedback generators to indicate a change in selection.
* @returns {Promise<any>} Returns a promise that resolves on success and rejects on error
*/
@Cordova()
2017-12-28 07:28:44 -05:00
selection(): Promise<any> {
return;
}
/**
* Use this to indicate success/failure/warning to the user.
* @param options {Object} should be of the type { type: 'success' } (or 'warning'/'error')
2018-09-25 20:29:32 +02:00
* @param {'success' | 'warning' | 'error'} options.type
* @returns {Promise<any>} Returns a promise that resolves on success and rejects on error
*/
@Cordova()
2017-12-28 07:28:44 -05:00
notification(options: { type: string }): Promise<any> {
return;
}
/**
* Use this to indicate success/failure/warning to the user.
* @param options {Object} should be of the type { style: 'light' } (or 'medium'/'heavy')
2018-09-25 20:29:32 +02:00
* @param {'light' | 'medium' | 'heavy'} options.type
* @returns {Promise<any>} Returns a promise that resolves on success and rejects on error
*/
@Cordova()
2017-12-28 07:28:44 -05:00
impact(options: { style: string }): Promise<any> {
return;
}
2018-09-25 20:29:32 +02:00
/**
* Tell the taptic engine that a gesture for a selection change is starting.
* @returns {Promise<any>}
*/
@Cordova()
gestureSelectionStart(): Promise<any> {
return;
}
/**
* Tell the taptic engine that a selection changed during a gesture.
* @returns {Promise<any>}
*/
@Cordova()
gestureSelectionChanged(): Promise<any> {
return;
}
/**
* Tell the taptic engine we are done with a gesture. This needs to be called lest resources are not properly recycled.
* @returns {Promise<any>}
*/
@Cordova()
gestureSelectionEnd(): Promise<any> {
return;
}
}