Add w3c_vibration.js
- Dominant language
- Java
- Stars
- 170
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
JavaScript has `navigator.vibrate` ( https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate ), however, Elemental2 doesn't have it.
It exists in the closure-compiler here: https://github.com/google/closure-compiler/blob/master/externs/browser/w3c_vibration.js
Can we pleae add it to Elemental2?
Until it's added, we need to us JSInterop:
```java
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public interface NavigatorVibrate {
@JsMethod
boolean vibrate(double milliseconds);
@JsMethod
boolean vibrate(double[] pattern);
}
```
```java
NavigatorVibrate nav = Js.cast(DomGlobal.navigator);
nav.vibrate(80);
```
Contributor guide
Assessment
This issue has not been assessed yet.