ionic-team / ionic-team/capacitor-haptics

@capacitor/haptics: Supported flag

Open
#6 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
5
PR merge metrics
No merged PRs in 30d

Description

## Feature Request

### Plugin

@capacitor/haptics

### Description

Apps may want to have an "Enable Haptic Feedback" toggle. However, such a toggle doesn't make sense on devices that don't support haptics (such as Apple A2HS or in the Safari app).

It would be nice if the Haptics plugin had a function to return a boolean if haptics are supported on the current device.

### Platform(s)

All

### Preferred Solution

`Haptics.supported()` or such

### Alternatives

Can do some rudimentary detection, such as:

`!isNative() && !("vibrate" in window.navigator)`

but that doesn't cover unsupported on native and may break if a new haptic web API is released.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.