fix:update isSupported check to expand detection of mobile devices#26
fix:update isSupported check to expand detection of mobile devices#26jayk293 wants to merge 2 commits intolochie:mainfrom
Conversation
create supportsVibrationAPI internal check for to replace isSupported to detect VibrationApi
|
@jayk293 is attempting to deploy a commit to the Lochie's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| static readonly isSupported: boolean = | ||
| typeof navigator !== "undefined" && | ||
| (typeof navigator.vibrate === "function" || | ||
| navigator.maxTouchPoints > 0); |
There was a problem hiding this comment.
after doing some research i dont think maxTouchPoints actually is accurate for when haptics are truly supported? i believe this would be true on touch enabled laptops 🤔
There was a problem hiding this comment.
Good spot. I did add some updates to ensure to validate the device is actually a mobile device.
iPads are not supported like iPhones in Web haptics, so made sure to not capture them as well.
Let me know what you think
…ce and not just a touch enabled device such as touch laptops or iPads
| ): Promise<void> { | ||
|
|
||
| if (!WebHaptics.isSupported && !this.debug) { | ||
| console.warn(`[web-haptics] Haptics not supported on this device.`,); |
There was a problem hiding this comment.
Not sure if this would get too verbose for your liking. Happy to remove
isSupportedis now expanded to handle all mobile devices withnavigator.maxTouchPoints > 0instead of just detection of the VibrationApi.