Skip to content

Commit 4586cb6

Browse files
authored
Merge pull request #579 from sjrd/cleanup-config-traits
Clean up config traits
2 parents 57a0c34 + 97906d4 commit 4586cb6

File tree

9 files changed

+1341
-992
lines changed

9 files changed

+1341
-992
lines changed

api-reports/2_12.txt

+333-250
Large diffs are not rendered by default.

api-reports/2_13.txt

+333-250
Large diffs are not rendered by default.

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

+43-29
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,70 @@ package org.scalajs.dom
33
import scala.scalajs.js
44
import scala.scalajs.js.annotation._
55

6-
@js.native
76
trait NotificationOptions extends js.Object {
87

98
/** The body property of the Notification interface indicates the body string of the notification. */
10-
val body: String = js.native
9+
var body: js.UndefOr[String] = js.undefined
1110

1211
/** The dir property of the Notification interface indicates the text direction of the notification. */
13-
val dir: String = js.native
12+
var dir: js.UndefOr[String] = js.undefined
1413

1514
/** The icon property of the Notification interface contains the URL of an icon to be displayed as part of the
1615
* notification.
1716
*/
18-
val icon: String = js.native
17+
var icon: js.UndefOr[String] = js.undefined
1918

2019
/** The lang property of the Notification interface indicates the text direction of the notification. */
21-
val lang: String = js.native
20+
var lang: js.UndefOr[String] = js.undefined
2221

2322
/** The noscreen property of the Notification interface specifies whether the notification firing should enable the
2423
* device's screen or not.
2524
*/
26-
val noscreen: Boolean = js.native
25+
var noscreen: js.UndefOr[Boolean] = js.undefined
2726

2827
/** The renotify property of the Notification interface specifies whether the user should be notified after a new
2928
* notification replaces an old one.
3029
*/
31-
val renotify: Boolean = js.native
30+
var renotify: js.UndefOr[Boolean] = js.undefined
3231

3332
/** The silent property of the Notification interface specifies whether the notification should be silent, i.e. no
3433
* sounds or vibrations should be issued, regardless of the device settings.
3534
*/
36-
val silent: Boolean = js.native
35+
var silent: js.UndefOr[Boolean] = js.undefined
3736

3837
/** The sound property of the Notification interface specifies the URL of an audio file to be played when the
3938
* notification fires.
4039
*/
41-
val sound: String = js.native
40+
var sound: js.UndefOr[String] = js.undefined
4241

4342
/** The sticky property of the Notification interface specifies whether the notification should be 'sticky', i.e. not
4443
* easily clearable by the user.
4544
*/
46-
val sticky: Boolean = js.native
45+
var sticky: js.UndefOr[Boolean] = js.undefined
4746

4847
/** The tag property of the Notification interface signifies an identifying tag for the notification.
4948
*
5049
* The idea of notification tags is that more than one notification can share the same tag, linking them together.
5150
* One notification can then be programmatically replaced with another to avoid the users' screen being filled up
5251
* with a huge number of similar notifications.
5352
*/
54-
val tag: String = js.native
53+
var tag: js.UndefOr[String] = js.undefined
5554

5655
/** The onclick property of the Notification interface specifies an event listener to receive click events. These
5756
* events occur when the user clicks on a displayed Notification.
5857
*/
59-
val onclick: js.Function0[Any] = js.native
58+
var onclick: js.UndefOr[js.Function0[Any]] = js.undefined
6059

6160
/** The onerror property of the Notification interface specifies an event listener to receive error events. These
6261
* events occur when something goes wrong with a Notification (in many cases an error preventing the notification
6362
* from being displayed.)
6463
*/
65-
val onerror: js.Function0[Any] = js.native
64+
var onerror: js.UndefOr[js.Function0[Any]] = js.undefined
6665

67-
val vibrate: js.Array[Double] = js.native
66+
var vibrate: js.UndefOr[js.Array[Double]] = js.undefined
6867
}
6968

69+
@deprecated("all members of NotificationOptions are deprecated", "2.0.0")
7070
object NotificationOptions {
7171

7272
/** Construct a new NotificationOptions
@@ -97,6 +97,7 @@ object NotificationOptions {
9797
* @return
9898
* a new NotificationOptions
9999
*/
100+
@deprecated("use `new NotificationOptions { ... }` instead", "2.0.0")
100101
@inline
101102
def apply(
102103
body: js.UndefOr[String] = js.undefined, dir: js.UndefOr[String] = js.undefined,
@@ -107,21 +108,34 @@ object NotificationOptions {
107108
onclick: js.UndefOr[js.Function0[Any]] = js.undefined, onerror: js.UndefOr[js.Function0[Any]] = js.undefined,
108109
vibrate: js.UndefOr[js.Array[Double]] = js.undefined
109110
): NotificationOptions = {
110-
val result = js.Dynamic.literal()
111-
body.foreach(result.body = _)
112-
dir.foreach(result.dir = _)
113-
icon.foreach(result.icon = _)
114-
lang.foreach(result.lang = _)
115-
noscreen.foreach(result.noscreen = _)
116-
renotify.foreach(result.renotify = _)
117-
silent.foreach(result.silent = _)
118-
sound.foreach(result.sound = _)
119-
sticky.foreach(result.sticky = _)
120-
tag.foreach(result.tag = _)
121-
onclick.foreach(result.onclick = _)
122-
onerror.foreach(result.onerror = _)
123-
vibrate.foreach(result.vibrate = _)
124-
result.asInstanceOf[NotificationOptions]
111+
val body0 = body
112+
val dir0 = dir
113+
val icon0 = icon
114+
val lang0 = lang
115+
val noscreen0 = noscreen
116+
val renotify0 = renotify
117+
val silent0 = silent
118+
val sound0 = sound
119+
val sticky0 = sticky
120+
val tag0 = tag
121+
val onclick0 = onclick
122+
val onerror0 = onerror
123+
val vibrate0 = vibrate
124+
new NotificationOptions {
125+
this.body = body0
126+
this.dir = dir0
127+
this.icon = icon0
128+
this.lang = lang0
129+
this.noscreen = noscreen0
130+
this.renotify = renotify0
131+
this.silent = silent0
132+
this.sound = sound0
133+
this.sticky = sticky0
134+
this.tag = tag0
135+
this.onclick = onclick0
136+
this.onerror = onerror0
137+
this.vibrate = vibrate0
138+
}
125139
}
126140
}
127141

0 commit comments

Comments
 (0)