mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
refactor(haptic): add tuple types (#15651)
This commit is contained in:
@ -53,7 +53,7 @@ export function hapticSelectionEnd() {
|
|||||||
* Use this to indicate success/failure/warning to the user.
|
* Use this to indicate success/failure/warning to the user.
|
||||||
* options should be of the type `{ type: 'success' }` (or `warning`/`error`)
|
* options should be of the type `{ type: 'success' }` (or `warning`/`error`)
|
||||||
*/
|
*/
|
||||||
export function hapticNotification(options: { type: string }) {
|
export function hapticNotification(options: { type: 'success' | 'warning' | 'error' }) {
|
||||||
const engine = (window as any).TapticEngine;
|
const engine = (window as any).TapticEngine;
|
||||||
if (engine) {
|
if (engine) {
|
||||||
engine.notification(options);
|
engine.notification(options);
|
||||||
@ -64,7 +64,7 @@ export function hapticNotification(options: { type: string }) {
|
|||||||
* Use this to indicate success/failure/warning to the user.
|
* Use this to indicate success/failure/warning to the user.
|
||||||
* options should be of the type `{ style: 'light' }` (or `medium`/`heavy`)
|
* options should be of the type `{ style: 'light' }` (or `medium`/`heavy`)
|
||||||
*/
|
*/
|
||||||
export function hapticImpact(options: { style: string }) {
|
export function hapticImpact(options: { style: 'light' | 'medium' | 'heavy' }) {
|
||||||
const engine = (window as any).TapticEngine;
|
const engine = (window as any).TapticEngine;
|
||||||
if (engine) {
|
if (engine) {
|
||||||
engine.impact(options);
|
engine.impact(options);
|
||||||
|
Reference in New Issue
Block a user