You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Haptics has native implementations, but no web implementation. The web plugin will make use of the web Vibration API to deliver functionality on vibration enabled devices (i.e. mobile). Note that some browsers implement permissions i.e. prompting the user to allow vibration when first run.
Platform(s)
Web
Preferred Solution
A Capacitor plugin which exposes the following functionality:
Vibration
Example Code
Behaviour
Once
navigator.vibrate(1000) or navigator.vibrate([1000])
Vibrate for 1000ms
Sequence
navigator.vibrate([50, 100, 150])
Vibrate for 50ms, still for 100ms, vibrate for 150ms
HapticsWeb.prototype.vibrate=function(options){if(!navigator.vibrate){returnPromise.reject('Web Haptics API not available');}returnnavigator.vibrate(options);};
node_modules\@capacitor\core\dist\esm\core-plugin-definitions.d.ts contains interface VibrateOptions but this never seems to be assigned anywhere i.e. not to HapticsPlugin.vibrate().
exportinterfaceVibrateOptions{duration?: number;}
The Web API requires options (a pattern) to be passed as number | number[]. It might be needed to review the implementation of VibrateOptions in order to use the same vibrate() method consistently across platforms.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.
Feature Request
Plugin
HapticsWeb (extends WebPlugin implements HapticsPlugin)
Description
Haptics has native implementations, but no web implementation. The web plugin will make use of the web Vibration API to deliver functionality on vibration enabled devices (i.e. mobile). Note that some browsers implement permissions i.e. prompting the user to allow vibration when first run.
Platform(s)
Web
Preferred Solution
A Capacitor plugin which exposes the following functionality:
navigator.vibrate(1000)
ornavigator.vibrate([1000])
navigator.vibrate([50, 100, 150])
navigator.vibrate(0)
ornavigator.vibrate([])
New Plugin
Vibrate Functionality
Additional Context
W3C Vibration API: https://www.w3.org/TR/vibration/
Google Chrome Samples: https://googlechrome.github.io/samples/vibration/
MDN Web Docs: https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API/
The text was updated successfully, but these errors were encountered: