Skip to content

Commit d7933f9

Browse files
committed
Move the Vibration API directly inside Navigator.
1 parent 797d4b2 commit d7933f9

File tree

4 files changed

+30
-39
lines changed

4 files changed

+30
-39
lines changed

api-reports/2_12.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -13891,6 +13891,8 @@ Navigator[JC] def languages: js.Array[String]
1389113891
Navigator[JC] def onLine: Boolean
1389213892
Navigator[JC] def platform: String
1389313893
Navigator[JC] def userAgent: String
13894+
Navigator[JC] def vibrate(duration: Double): Boolean
13895+
Navigator[JC] def vibrate(pattern: js.Array[Double]): Boolean
1389413896
NavigatorContentUtils[JT]
1389513897
NavigatorGeolocation[JT] def geolocation: Geolocation
1389613898
NavigatorID[JT] def appName: String
@@ -13901,6 +13903,8 @@ NavigatorLanguage[JT] def language: String
1390113903
NavigatorLanguage[JT] def languages: js.Array[String]
1390213904
NavigatorOnLine[JT] def onLine: Boolean
1390313905
NavigatorStorageUtils[JT]
13906+
NavigatorVibration[JT] def vibrate(duration: Double): Boolean
13907+
NavigatorVibration[JT] def vibrate(pattern: js.Array[Double]): Boolean
1390413908
Node[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
1390513909
Node[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
1390613910
Node[JC] def appendChild(newChild: Node): Node
@@ -23428,11 +23432,7 @@ experimental/URLSearchParams[JC] def keys(): js.Iterator[String]
2342823432
experimental/URLSearchParams[JC] def set(name: String, value: String): Unit
2342923433
experimental/URLSearchParams[JC] def sort(): Unit
2343023434
experimental/URLSearchParams[JC] def values(): js.Iterator[String]
23431-
experimental/Vibration[SO] implicit def toVibration(n: org.scalajs.dom.Navigator): VibrationNavigator
23432-
experimental/Vibration[SO] def vibrate(duration: Double): Boolean
23433-
experimental/Vibration[SO] def vibrate(pattern: js.Array[Double]): Boolean
23434-
experimental/Vibration.VibrationNavigator[JT] def vibrate(duration: Double): Boolean
23435-
experimental/Vibration.VibrationNavigator[JT] def vibrate(pattern: js.Array[Double]): Boolean
23435+
experimental/Vibration[SO] (@deprecated in 2.0.0)
2343623436
experimental/WriteableState[JT]
2343723437
experimental/WriteableState[SO] val closed = "closed".asInstanceOf[WriteableState]
2343823438
experimental/WriteableState[SO] val closing = "closing".asInstanceOf[WriteableState]

api-reports/2_13.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -13891,6 +13891,8 @@ Navigator[JC] def languages: js.Array[String]
1389113891
Navigator[JC] def onLine: Boolean
1389213892
Navigator[JC] def platform: String
1389313893
Navigator[JC] def userAgent: String
13894+
Navigator[JC] def vibrate(duration: Double): Boolean
13895+
Navigator[JC] def vibrate(pattern: js.Array[Double]): Boolean
1389413896
NavigatorContentUtils[JT]
1389513897
NavigatorGeolocation[JT] def geolocation: Geolocation
1389613898
NavigatorID[JT] def appName: String
@@ -13901,6 +13903,8 @@ NavigatorLanguage[JT] def language: String
1390113903
NavigatorLanguage[JT] def languages: js.Array[String]
1390213904
NavigatorOnLine[JT] def onLine: Boolean
1390313905
NavigatorStorageUtils[JT]
13906+
NavigatorVibration[JT] def vibrate(duration: Double): Boolean
13907+
NavigatorVibration[JT] def vibrate(pattern: js.Array[Double]): Boolean
1390413908
Node[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
1390513909
Node[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
1390613910
Node[JC] def appendChild(newChild: Node): Node
@@ -23428,11 +23432,7 @@ experimental/URLSearchParams[JC] def keys(): js.Iterator[String]
2342823432
experimental/URLSearchParams[JC] def set(name: String, value: String): Unit
2342923433
experimental/URLSearchParams[JC] def sort(): Unit
2343023434
experimental/URLSearchParams[JC] def values(): js.Iterator[String]
23431-
experimental/Vibration[SO] implicit def toVibration(n: org.scalajs.dom.Navigator): VibrationNavigator
23432-
experimental/Vibration[SO] def vibrate(duration: Double): Boolean
23433-
experimental/Vibration[SO] def vibrate(pattern: js.Array[Double]): Boolean
23434-
experimental/Vibration.VibrationNavigator[JT] def vibrate(duration: Double): Boolean
23435-
experimental/Vibration.VibrationNavigator[JT] def vibrate(pattern: js.Array[Double]): Boolean
23435+
experimental/Vibration[SO] (@deprecated in 2.0.0)
2343623436
experimental/WriteableState[JT]
2343723437
experimental/WriteableState[SO] val closed = "closed".asInstanceOf[WriteableState]
2343823438
experimental/WriteableState[SO] val closing = "closing".asInstanceOf[WriteableState]
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
11
package org.scalajs.dom.experimental
22

3-
import scala.language.implicitConversions
4-
import scala.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",
4+
"2.0.0")
5+
object Vibration

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

+17-2
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ trait WindowTimers extends js.Object {
490490
@JSGlobal
491491
class Navigator
492492
extends NavigatorID with NavigatorOnLine with NavigatorContentUtils
493-
with NavigatorGeolocation with NavigatorStorageUtils
494-
with NavigatorLanguage {
493+
with NavigatorGeolocation with NavigatorStorageUtils with NavigatorLanguage
494+
with NavigatorVibration {
495495

496496
/**
497497
* The Clipboard API adds to the Navigator interface the read-only
@@ -5460,6 +5460,21 @@ trait WindowLocalStorage extends js.Object {
54605460
@js.native
54615461
trait NavigatorStorageUtils extends js.Object
54625462

5463+
@js.native
5464+
trait NavigatorVibration extends js.Object {
5465+
5466+
/** Vibrate the device for the specified number of milliseconds. */
5467+
def vibrate(duration: Double): Boolean = js.native
5468+
5469+
/**
5470+
* Vibrate the device in the given pattern.
5471+
*
5472+
* @param pattern the pattern to vibrate. The first number is the initial
5473+
* duration, the subsequent a delay of silence, and so on.
5474+
*/
5475+
def vibrate(pattern: js.Array[Double]): Boolean = js.native
5476+
}
5477+
54635478
/**
54645479
* The Location interface represents the location of the object it is linked to.
54655480
* Changes done on it are reflected on the object it relates to. Both the Document and

0 commit comments

Comments
 (0)