Updated Notification APIs (#3667)

* Updated Notification APIs

* Updated Notification APIs

* Update crates/web-sys/webidls/enabled/Notification.webidl

Co-authored-by: daxpedda <daxpedda@gmail.com>

* Update crates/web-sys/webidls/enabled/Notification.webidl

Co-authored-by: daxpedda <daxpedda@gmail.com>

* added entries to changelog

* regenerated

* Update CHANGELOG.md with new additions

* Update CHANGELOG.md

Co-authored-by: daxpedda <daxpedda@gmail.com>

---------

Co-authored-by: daxpedda <daxpedda@gmail.com>
This commit is contained in:
Marc-Stefan Cassola 2023-10-27 13:04:51 +01:00 committed by GitHub
parent 54f22ee0a5
commit a03d23bd16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 251 additions and 246 deletions

View File

@ -67,6 +67,9 @@
proc-macro and accept the `--include-ignored` flag with `wasm-bindgen-test-runner`.
[#3644](https://github.com/rustwasm/wasm-bindgen/pull/3644)
* Added missing additions to the Notification API.
[#3667](https://github.com/rustwasm/wasm-bindgen/pull/3667)
### Changed
* Updated the WebGPU WebIDL.
@ -157,6 +160,9 @@
* Removed `ReadableStreamByobReader::read_with_u8_array()` because it doesn't work with Wasm.
[#3582](https://github.com/rustwasm/wasm-bindgen/pull/3582)
* Removed `GetNotificationOptions`, `NotificationBehavior` and `Notification.get()` because
they don't exist anymore.
## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87)
Released 2023-06-12.

View File

@ -444,7 +444,6 @@ GamepadPose = []
GamepadServiceTest = []
Geolocation = []
GetAnimationsOptions = []
GetNotificationOptions = []
GetRootNodeOptions = []
GetUserMediaRequest = []
Gpu = []
@ -880,7 +879,7 @@ NodeFilter = []
NodeIterator = []
NodeList = []
Notification = ["EventTarget"]
NotificationBehavior = []
NotificationAction = []
NotificationDirection = []
NotificationEvent = ["Event", "ExtendableEvent"]
NotificationEventInit = []

View File

@ -1,41 +0,0 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GetNotificationOptions)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `GetNotificationOptions` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GetNotificationOptions`*"]
pub type GetNotificationOptions;
}
impl GetNotificationOptions {
#[doc = "Construct a new `GetNotificationOptions`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GetNotificationOptions`*"]
pub fn new() -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
#[doc = "Change the `tag` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GetNotificationOptions`*"]
pub fn tag(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("tag"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
impl Default for GetNotificationOptions {
fn default() -> Self {
Self::new()
}
}

View File

@ -20,6 +20,13 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`, `NotificationPermission`*"]
pub fn permission() -> NotificationPermission;
# [wasm_bindgen (structural , static_method_of = Notification , getter , js_class = "Notification" , js_name = maxActions)]
#[doc = "Getter for the `maxActions` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/maxActions)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn max_actions() -> u32;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = onclick)]
#[doc = "Getter for the `onclick` field of this object."]
#[doc = ""]
@ -112,6 +119,13 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn tag(this: &Notification) -> Option<String>;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = image)]
#[doc = "Getter for the `image` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/image)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn image(this: &Notification) -> String;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = icon)]
#[doc = "Getter for the `icon` field of this object."]
#[doc = ""]
@ -119,6 +133,41 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn icon(this: &Notification) -> Option<String>;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = badge)]
#[doc = "Getter for the `badge` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/badge)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn badge(this: &Notification) -> String;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = vibrate)]
#[doc = "Getter for the `vibrate` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/vibrate)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn vibrate(this: &Notification) -> ::js_sys::Array;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = timestamp)]
#[doc = "Getter for the `timestamp` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/timestamp)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn timestamp(this: &Notification) -> f64;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = renotify)]
#[doc = "Getter for the `renotify` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/renotify)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn renotify(this: &Notification) -> bool;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = silent)]
#[doc = "Getter for the `silent` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/silent)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn silent(this: &Notification) -> Option<bool>;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = requireInteraction)]
#[doc = "Getter for the `requireInteraction` field of this object."]
#[doc = ""]
@ -133,6 +182,13 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn data(this: &Notification) -> ::wasm_bindgen::JsValue;
# [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = actions)]
#[doc = "Getter for the `actions` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/actions)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn actions(this: &Notification) -> ::js_sys::Array;
#[wasm_bindgen(catch, constructor, js_class = "Notification")]
#[doc = "The `new Notification(..)` constructor, creating a new instance of `Notification`."]
#[doc = ""]
@ -158,21 +214,6 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn close(this: &Notification);
# [wasm_bindgen (catch , static_method_of = Notification , js_class = "Notification" , js_name = get)]
#[doc = "The `get()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/get)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Notification`*"]
pub fn get() -> Result<::js_sys::Promise, JsValue>;
#[cfg(feature = "GetNotificationOptions")]
# [wasm_bindgen (catch , static_method_of = Notification , js_class = "Notification" , js_name = get)]
#[doc = "The `get()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/get)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GetNotificationOptions`, `Notification`*"]
pub fn get_with_filter(filter: &GetNotificationOptions) -> Result<::js_sys::Promise, JsValue>;
# [wasm_bindgen (catch , static_method_of = Notification , js_class = "Notification" , js_name = requestPermission)]
#[doc = "The `requestPermission()` method."]
#[doc = ""]

View File

@ -0,0 +1,65 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = NotificationAction)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `NotificationAction` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"]
pub type NotificationAction;
}
impl NotificationAction {
#[doc = "Construct a new `NotificationAction`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"]
pub fn new(action: &str, title: &str) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.action(action);
ret.title(title);
ret
}
#[doc = "Change the `action` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"]
pub fn action(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r =
::js_sys::Reflect::set(self.as_ref(), &JsValue::from("action"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `icon` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"]
pub fn icon(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("icon"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `title` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"]
pub fn title(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("title"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}

View File

@ -1,113 +0,0 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = NotificationBehavior)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `NotificationBehavior` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationBehavior`*"]
pub type NotificationBehavior;
}
impl NotificationBehavior {
#[doc = "Construct a new `NotificationBehavior`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationBehavior`*"]
pub fn new() -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
#[doc = "Change the `noclear` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationBehavior`*"]
pub fn noclear(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("noclear"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `noscreen` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationBehavior`*"]
pub fn noscreen(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("noscreen"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `showOnlyOnce` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationBehavior`*"]
pub fn show_only_once(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("showOnlyOnce"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `soundFile` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationBehavior`*"]
pub fn sound_file(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("soundFile"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `vibrationPattern` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationBehavior`*"]
pub fn vibration_pattern(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("vibrationPattern"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
impl Default for NotificationBehavior {
fn default() -> Self {
Self::new()
}
}

View File

@ -20,6 +20,36 @@ impl NotificationOptions {
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
#[doc = "Change the `actions` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
pub fn actions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("actions"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `badge` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
pub fn badge(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("badge"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `body` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
@ -73,6 +103,19 @@ impl NotificationOptions {
let _ = r;
self
}
#[doc = "Change the `image` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
pub fn image(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("image"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `lang` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
@ -86,6 +129,23 @@ impl NotificationOptions {
let _ = r;
self
}
#[doc = "Change the `renotify` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
pub fn renotify(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("renotify"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `requireInteraction` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
@ -103,6 +163,20 @@ impl NotificationOptions {
let _ = r;
self
}
#[doc = "Change the `silent` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
pub fn silent(&mut self, val: Option<bool>) -> &mut Self {
use wasm_bindgen::JsValue;
let r =
::js_sys::Reflect::set(self.as_ref(), &JsValue::from("silent"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `tag` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
@ -116,6 +190,23 @@ impl NotificationOptions {
let _ = r;
self
}
#[doc = "Change the `timestamp` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"]
pub fn timestamp(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("timestamp"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
impl Default for NotificationOptions {
fn default() -> Self {

View File

@ -84,17 +84,6 @@ extern "C" {
pub fn get_notifications(
this: &ServiceWorkerRegistration,
) -> Result<::js_sys::Promise, JsValue>;
#[cfg(feature = "GetNotificationOptions")]
# [wasm_bindgen (catch , method , structural , js_class = "ServiceWorkerRegistration" , js_name = getNotifications)]
#[doc = "The `getNotifications()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/getNotifications)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GetNotificationOptions`, `ServiceWorkerRegistration`*"]
pub fn get_notifications_with_filter(
this: &ServiceWorkerRegistration,
filter: &GetNotificationOptions,
) -> Result<::js_sys::Promise, JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ServiceWorkerRegistration" , js_name = showNotification)]
#[doc = "The `showNotification()` method."]
#[doc = ""]

View File

@ -2476,12 +2476,6 @@ mod gen_GetAnimationsOptions;
#[cfg(feature = "GetAnimationsOptions")]
pub use gen_GetAnimationsOptions::*;
#[cfg(feature = "GetNotificationOptions")]
#[allow(non_snake_case)]
mod gen_GetNotificationOptions;
#[cfg(feature = "GetNotificationOptions")]
pub use gen_GetNotificationOptions::*;
#[cfg(feature = "GetRootNodeOptions")]
#[allow(non_snake_case)]
mod gen_GetRootNodeOptions;
@ -5092,11 +5086,11 @@ mod gen_Notification;
#[cfg(feature = "Notification")]
pub use gen_Notification::*;
#[cfg(feature = "NotificationBehavior")]
#[cfg(feature = "NotificationAction")]
#[allow(non_snake_case)]
mod gen_NotificationBehavior;
#[cfg(feature = "NotificationBehavior")]
pub use gen_NotificationBehavior::*;
mod gen_NotificationAction;
#[cfg(feature = "NotificationAction")]
pub use gen_NotificationAction::*;
#[cfg(feature = "NotificationDirection")]
#[allow(non_snake_case)]

View File

@ -1,60 +1,34 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://notifications.spec.whatwg.org/
*
* Copyright:
* To the extent possible under law, the editors have waived all copyright and
* related or neighboring rights to this work.
*/
[Constructor(DOMString title, optional NotificationOptions options),
Exposed=(Window,Worker),
Func="mozilla::dom::Notification::PrefEnabled"]
[Exposed=(Window,Worker)]
interface Notification : EventTarget {
[GetterThrows]
constructor(DOMString title, optional NotificationOptions options = {});
static readonly attribute NotificationPermission permission;
[Throws, Func="mozilla::dom::Notification::RequestPermissionEnabledForScope"]
static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback permissionCallback);
[Throws, Func="mozilla::dom::Notification::IsGetEnabled"]
static Promise<sequence<Notification>> get(optional GetNotificationOptions filter);
static readonly attribute unsigned long maxActions;
attribute EventHandler onclick;
attribute EventHandler onshow;
attribute EventHandler onerror;
attribute EventHandler onclose;
[Pure]
readonly attribute DOMString title;
[Pure]
readonly attribute NotificationDirection dir;
[Pure]
readonly attribute DOMString? lang;
[Pure]
readonly attribute DOMString? body;
[Constant]
readonly attribute DOMString? tag;
[Pure]
readonly attribute DOMString? icon;
[Constant, Func="mozilla::dom::DOMPrefs::NotificationRIEnabled"]
readonly attribute USVString image;
readonly attribute USVString? icon;
readonly attribute USVString badge;
[SameObject] readonly attribute FrozenArray<unsigned long> vibrate;
readonly attribute unsigned long long timestamp;
readonly attribute boolean renotify;
readonly attribute boolean? silent;
readonly attribute boolean requireInteraction;
[Constant]
readonly attribute any data;
[SameObject] readonly attribute any data;
[SameObject] readonly attribute FrozenArray<NotificationAction> actions;
undefined close();
};
@ -64,21 +38,15 @@ dictionary NotificationOptions {
DOMString lang = "";
DOMString body = "";
DOMString tag = "";
DOMString icon = "";
USVString image;
USVString icon;
USVString badge;
unsigned long long timestamp;
boolean renotify = false;
boolean? silent = null;
boolean requireInteraction = false;
any data = null;
};
dictionary GetNotificationOptions {
DOMString tag = "";
};
dictionary NotificationBehavior {
boolean noscreen = false;
boolean noclear = false;
boolean showOnlyOnce = false;
DOMString soundFile = "";
sequence<unsigned long> vibrationPattern;
sequence<NotificationAction> actions = [];
};
enum NotificationPermission {
@ -87,10 +55,16 @@ enum NotificationPermission {
"granted"
};
callback NotificationPermissionCallback = undefined (NotificationPermission permission);
enum NotificationDirection {
"auto",
"ltr",
"rtl"
};
dictionary NotificationAction {
required DOMString action;
required DOMString title;
USVString icon;
};
callback NotificationPermissionCallback = undefined (NotificationPermission permission);