Skip to content

Commit 49049be

Browse files
committed
Add experimental Vibration API
1 parent 13404aa commit 49049be

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.scalajs.dom.experimental
2+
3+
import scalajs.js
4+
5+
/**
6+
* Implicit imports for the vibration api.
7+
*
8+
* http://www.w3.org/TR/2015/REC-vibration-20150210/
9+
*/
10+
object Vibration {
11+
implicit class VibrationNavigator(val n: org.scalajs.dom.Navigator) extends js.Any {
12+
/** Vibrate the device for the specified number of milliseconds. */
13+
def vibrate(duration: Double): Boolean = js.native
14+
15+
/**
16+
* Vibrate the device in the given pattern.
17+
*
18+
* @param pattern the pattern to vibrate. The first number is the initial
19+
* duration, the subsequent a delay of silence, and so on.
20+
*/
21+
def vibrate(pattern: js.Array[Double]): Boolean = js.native
22+
}
23+
}

0 commit comments

Comments
 (0)