Skip to content

Clean up config traits #579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
583 changes: 333 additions & 250 deletions api-reports/2_12.txt

Large diffs are not rendered by default.

583 changes: 333 additions & 250 deletions api-reports/2_13.txt

Large diffs are not rendered by default.

72 changes: 43 additions & 29 deletions src/main/scala/org/scalajs/dom/Notification.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,70 @@ package org.scalajs.dom
import scala.scalajs.js
import scala.scalajs.js.annotation._

@js.native
trait NotificationOptions extends js.Object {

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

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

/** The icon property of the Notification interface contains the URL of an icon to be displayed as part of the
* notification.
*/
val icon: String = js.native
var icon: js.UndefOr[String] = js.undefined

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

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

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

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

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

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

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

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

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

val vibrate: js.Array[Double] = js.native
var vibrate: js.UndefOr[js.Array[Double]] = js.undefined
}

@deprecated("all members of NotificationOptions are deprecated", "2.0.0")
object NotificationOptions {

/** Construct a new NotificationOptions
Expand Down Expand Up @@ -97,6 +97,7 @@ object NotificationOptions {
* @return
* a new NotificationOptions
*/
@deprecated("use `new NotificationOptions { ... }` instead", "2.0.0")
@inline
def apply(
body: js.UndefOr[String] = js.undefined, dir: js.UndefOr[String] = js.undefined,
Expand All @@ -107,21 +108,34 @@ object NotificationOptions {
onclick: js.UndefOr[js.Function0[Any]] = js.undefined, onerror: js.UndefOr[js.Function0[Any]] = js.undefined,
vibrate: js.UndefOr[js.Array[Double]] = js.undefined
): NotificationOptions = {
val result = js.Dynamic.literal()
body.foreach(result.body = _)
dir.foreach(result.dir = _)
icon.foreach(result.icon = _)
lang.foreach(result.lang = _)
noscreen.foreach(result.noscreen = _)
renotify.foreach(result.renotify = _)
silent.foreach(result.silent = _)
sound.foreach(result.sound = _)
sticky.foreach(result.sticky = _)
tag.foreach(result.tag = _)
onclick.foreach(result.onclick = _)
onerror.foreach(result.onerror = _)
vibrate.foreach(result.vibrate = _)
result.asInstanceOf[NotificationOptions]
val body0 = body
val dir0 = dir
val icon0 = icon
val lang0 = lang
val noscreen0 = noscreen
val renotify0 = renotify
val silent0 = silent
val sound0 = sound
val sticky0 = sticky
val tag0 = tag
val onclick0 = onclick
val onerror0 = onerror
val vibrate0 = vibrate
new NotificationOptions {
this.body = body0
this.dir = dir0
this.icon = icon0
this.lang = lang0
this.noscreen = noscreen0
this.renotify = renotify0
this.silent = silent0
this.sound = sound0
this.sticky = sticky0
this.tag = tag0
this.onclick = onclick0
this.onerror = onerror0
this.vibrate = vibrate0
}
}
}

Expand Down
Loading