Skip to content

Commit c89bfa2

Browse files
committed
Move the Vibration API directly inside Navigator.
1 parent dee09be commit c89bfa2

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,4 @@
11
package org.scalajs.dom.experimental
22

3-
import scala.language.implicitConversions
4-
import scalajs.js
5-
6-
/**
7-
* Implicit imports for the vibration api.
8-
*
9-
* http://www.w3.org/TR/2015/REC-vibration-20150210/
10-
*/
11-
object Vibration {
12-
implicit def toVibration(n: org.scalajs.dom.Navigator): VibrationNavigator =
13-
n.asInstanceOf[VibrationNavigator]
14-
15-
@js.native
16-
trait VibrationNavigator extends js.Any {
17-
18-
/** Vibrate the device for the specified number of milliseconds. */
19-
def vibrate(duration: Double): Boolean = js.native
20-
21-
/**
22-
* Vibrate the device in the given pattern.
23-
*
24-
* @param pattern the pattern to vibrate. The first number is the initial
25-
* duration, the subsequent a delay of silence, and so on.
26-
*/
27-
def vibrate(pattern: js.Array[Double]): Boolean = js.native
28-
}
29-
}
3+
@deprecated("the extensions of Vibration are now available by default", "2.0.0")
4+
object Vibration

src/main/scala/org/scalajs/dom/lib.scala

+15-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ trait WindowTimers extends js.Object {
492492
class Navigator
493493
extends NavigatorID with NavigatorOnLine with NavigatorContentUtils
494494
with NavigatorGeolocation with NavigatorStorageUtils
495-
with NavigatorLanguage {
495+
with NavigatorLanguage with NavigatorVibration {
496496

497497
/**
498498
* The Clipboard API adds to the Navigator interface the read-only
@@ -5367,6 +5367,20 @@ trait WindowLocalStorage extends js.Object {
53675367
@js.native
53685368
trait NavigatorStorageUtils extends js.Object
53695369

5370+
@js.native
5371+
trait NavigatorVibration extends js.Object {
5372+
/** Vibrate the device for the specified number of milliseconds. */
5373+
def vibrate(duration: Double): Boolean = js.native
5374+
5375+
/**
5376+
* Vibrate the device in the given pattern.
5377+
*
5378+
* @param pattern the pattern to vibrate. The first number is the initial
5379+
* duration, the subsequent a delay of silence, and so on.
5380+
*/
5381+
def vibrate(pattern: js.Array[Double]): Boolean = js.native
5382+
}
5383+
53705384
/**
53715385
* The Location interface represents the location of the object it is linked to.
53725386
* Changes done on it are reflected on the object it relates to. Both the Document and

0 commit comments

Comments
 (0)