Vibrate from script?

Hi, I tried to call Vibration API in several ways, with no luck. It seems like we cannot call Vibration API from scripts - do you see some way to do it? It could be very helpful feature when using smartphones or tablets to have ability to make a custom vibration feedback.

Cheers, Teo

I'll expose the whole Navigator object as globals.navigator with getNavigator() in next release, this should open some interesting perspectives.

2 Likes

I'm very glad to hear it! Looking forward to upgrade my control designs with this feature! Cheers, Teo

Hi, is there a possibility to try this new feature? Nightly build or something? Thanks

v1.20.0 will be available in a moment.

I would love to see some examples of how getNavigator() can be used :slight_smile:

hi @matcham

navigator = getNavigator()
console.log(navigator)

if (navigator.userActivation.isActive) {
  // proceed to request playing media, for example
  navigator.vibrate(200);
}