From 6788a8fb157a8b63deb655a68ff82308f4302a8a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 25 Aug 2023 11:39:33 +0200 Subject: [PATCH] Prioritized Task Scheduling API (#3566) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 11 ++ .../src/features/gen_IsInputPendingOptions.rs | 58 +++++++++ crates/web-sys/src/features/gen_Navigator.rs | 12 ++ crates/web-sys/src/features/gen_Scheduler.rs | 46 +++++++ .../features/gen_SchedulerPostTaskOptions.rs | 95 ++++++++++++++ crates/web-sys/src/features/gen_Scheduling.rs | 45 +++++++ .../src/features/gen_TaskController.rs | 54 ++++++++ .../src/features/gen_TaskControllerInit.rs | 59 +++++++++ .../web-sys/src/features/gen_TaskPriority.rs | 17 +++ .../features/gen_TaskPriorityChangeEvent.rs | 46 +++++++ .../gen_TaskPriorityChangeEventInit.rs | 118 ++++++++++++++++++ crates/web-sys/src/features/gen_TaskSignal.rs | 77 ++++++++++++ .../src/features/gen_TaskSignalAnyInit.rs | 58 +++++++++ crates/web-sys/src/features/gen_Window.rs | 12 ++ .../src/features/gen_WorkerGlobalScope.rs | 12 ++ crates/web-sys/src/features/mod.rs | 66 ++++++++++ .../webidls/unstable/is-input-pending.webidl | 11 ++ .../webidls/unstable/scheduling-apis.webidl | 58 +++++++++ 19 files changed, 858 insertions(+) create mode 100644 crates/web-sys/src/features/gen_IsInputPendingOptions.rs create mode 100644 crates/web-sys/src/features/gen_Scheduler.rs create mode 100644 crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs create mode 100644 crates/web-sys/src/features/gen_Scheduling.rs create mode 100644 crates/web-sys/src/features/gen_TaskController.rs create mode 100644 crates/web-sys/src/features/gen_TaskControllerInit.rs create mode 100644 crates/web-sys/src/features/gen_TaskPriority.rs create mode 100644 crates/web-sys/src/features/gen_TaskPriorityChangeEvent.rs create mode 100644 crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs create mode 100644 crates/web-sys/src/features/gen_TaskSignal.rs create mode 100644 crates/web-sys/src/features/gen_TaskSignalAnyInit.rs create mode 100644 crates/web-sys/webidls/unstable/is-input-pending.webidl create mode 100644 crates/web-sys/webidls/unstable/scheduling-apis.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 5964d2a99..44fd41c53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,9 @@ * Add bindings for `HTMLElement.inert`. [#3557](https://github.com/rustwasm/wasm-bindgen/pull/3557) +* Add unstable bindings for the Prioritized Task Scheduling API. + [#3566](https://github.com/rustwasm/wasm-bindgen/pull/3566) + ### Changed * Updated the WebGPU WebIDL. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index c648fdeb4..64d770013 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -733,6 +733,7 @@ IntersectionObserverEntry = [] IntersectionObserverEntryInit = [] IntersectionObserverInit = [] IntlUtils = [] +IsInputPendingOptions = [] IterableKeyAndValueResult = [] IterableKeyOrValueResult = [] IterationCompositeOperation = [] @@ -1130,6 +1131,9 @@ RtcdtmfToneChangeEvent = ["Event"] RtcdtmfToneChangeEventInit = [] RtcrtpContributingSourceStats = [] RtcrtpStreamStats = [] +Scheduler = [] +SchedulerPostTaskOptions = [] +Scheduling = [] Screen = ["EventTarget"] ScreenColorGamut = [] ScreenLuminance = [] @@ -1338,6 +1342,13 @@ SvggElement = ["Element", "EventTarget", "Node", "SvgElement", "SvgGraphicsEleme SvgmPathElement = ["Element", "EventTarget", "Node", "SvgElement"] SvgsvgElement = ["Element", "EventTarget", "Node", "SvgElement", "SvgGraphicsElement"] SvgtSpanElement = ["Element", "EventTarget", "Node", "SvgElement", "SvgGraphicsElement", "SvgTextContentElement", "SvgTextPositioningElement"] +TaskController = ["AbortController"] +TaskControllerInit = [] +TaskPriority = [] +TaskPriorityChangeEvent = ["Event"] +TaskPriorityChangeEventInit = [] +TaskSignal = ["AbortSignal", "EventTarget"] +TaskSignalAnyInit = [] TcpReadyState = [] TcpServerSocket = ["EventTarget"] TcpServerSocketEvent = ["Event"] diff --git a/crates/web-sys/src/features/gen_IsInputPendingOptions.rs b/crates/web-sys/src/features/gen_IsInputPendingOptions.rs new file mode 100644 index 000000000..9820eb88b --- /dev/null +++ b/crates/web-sys/src/features/gen_IsInputPendingOptions.rs @@ -0,0 +1,58 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = IsInputPendingOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `IsInputPendingOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type IsInputPendingOptions; +} +#[cfg(web_sys_unstable_apis)] +impl IsInputPendingOptions { + #[doc = "Construct a new `IsInputPendingOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `includeContinuous` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn include_continuous(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("includeContinuous"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for IsInputPendingOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index 7bb30670f..dbd6fad89 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -201,6 +201,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn xr(this: &Navigator) -> XrSystem; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Scheduling")] + # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = scheduling)] + #[doc = "Getter for the `scheduling` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/scheduling)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Navigator`, `Scheduling`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scheduling(this: &Navigator) -> Scheduling; # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = hardwareConcurrency)] #[doc = "Getter for the `hardwareConcurrency` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Scheduler.rs b/crates/web-sys/src/features/gen_Scheduler.rs new file mode 100644 index 000000000..09966ed0c --- /dev/null +++ b/crates/web-sys/src/features/gen_Scheduler.rs @@ -0,0 +1,46 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Scheduler , typescript_type = "Scheduler")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Scheduler` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type Scheduler; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "Scheduler" , js_name = postTask)] + #[doc = "The `postTask()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn post_task(this: &Scheduler, callback: &::js_sys::Function) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SchedulerPostTaskOptions")] + # [wasm_bindgen (method , structural , js_class = "Scheduler" , js_name = postTask)] + #[doc = "The `postTask()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`, `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn post_task_with_options( + this: &Scheduler, + callback: &::js_sys::Function, + options: &SchedulerPostTaskOptions, + ) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs b/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs new file mode 100644 index 000000000..d1e8818cb --- /dev/null +++ b/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs @@ -0,0 +1,95 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SchedulerPostTaskOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SchedulerPostTaskOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SchedulerPostTaskOptions; +} +#[cfg(web_sys_unstable_apis)] +impl SchedulerPostTaskOptions { + #[doc = "Construct a new `SchedulerPostTaskOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn delay(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("delay"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn priority(&mut self, val: TaskPriority) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("priority"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for SchedulerPostTaskOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Scheduling.rs b/crates/web-sys/src/features/gen_Scheduling.rs new file mode 100644 index 000000000..a6f0748e0 --- /dev/null +++ b/crates/web-sys/src/features/gen_Scheduling.rs @@ -0,0 +1,45 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Scheduling , typescript_type = "Scheduling")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Scheduling` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduling)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduling`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type Scheduling; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "Scheduling" , js_name = isInputPending)] + #[doc = "The `isInputPending()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduling/isInputPending)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduling`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_input_pending(this: &Scheduling) -> bool; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "IsInputPendingOptions")] + # [wasm_bindgen (method , structural , js_class = "Scheduling" , js_name = isInputPending)] + #[doc = "The `isInputPending()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduling/isInputPending)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`, `Scheduling`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_input_pending_with_is_input_pending_options( + this: &Scheduling, + is_input_pending_options: &IsInputPendingOptions, + ) -> bool; +} diff --git a/crates/web-sys/src/features/gen_TaskController.rs b/crates/web-sys/src/features/gen_TaskController.rs new file mode 100644 index 000000000..f108a34c4 --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskController.rs @@ -0,0 +1,54 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = AbortController , extends = :: js_sys :: Object , js_name = TaskController , typescript_type = "TaskController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskController`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskController; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "TaskController")] + #[doc = "The `new TaskController(..)` constructor, creating a new instance of `TaskController`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController/TaskController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskController`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskControllerInit")] + #[wasm_bindgen(catch, constructor, js_class = "TaskController")] + #[doc = "The `new TaskController(..)` constructor, creating a new instance of `TaskController`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController/TaskController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskController`, `TaskControllerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_init(init: &TaskControllerInit) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + # [wasm_bindgen (method , structural , js_class = "TaskController" , js_name = setPriority)] + #[doc = "The `setPriority()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController/setPriority)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskController`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_priority(this: &TaskController, priority: TaskPriority); +} diff --git a/crates/web-sys/src/features/gen_TaskControllerInit.rs b/crates/web-sys/src/features/gen_TaskControllerInit.rs new file mode 100644 index 000000000..e66e8663d --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskControllerInit.rs @@ -0,0 +1,59 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TaskControllerInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskControllerInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskControllerInit; +} +#[cfg(web_sys_unstable_apis)] +impl TaskControllerInit { + #[doc = "Construct a new `TaskControllerInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn priority(&mut self, val: TaskPriority) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("priority"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for TaskControllerInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_TaskPriority.rs b/crates/web-sys/src/features/gen_TaskPriority.rs new file mode 100644 index 000000000..4d04fe23c --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskPriority.rs @@ -0,0 +1,17 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `TaskPriority` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `TaskPriority`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum TaskPriority { + UserBlocking = "user-blocking", + UserVisible = "user-visible", + Background = "background", +} diff --git a/crates/web-sys/src/features/gen_TaskPriorityChangeEvent.rs b/crates/web-sys/src/features/gen_TaskPriorityChangeEvent.rs new file mode 100644 index 000000000..618696a7b --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskPriorityChangeEvent.rs @@ -0,0 +1,46 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = TaskPriorityChangeEvent , typescript_type = "TaskPriorityChangeEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskPriorityChangeEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskPriorityChangeEvent; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + # [wasm_bindgen (structural , method , getter , js_class = "TaskPriorityChangeEvent" , js_name = previousPriority)] + #[doc = "Getter for the `previousPriority` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent/previousPriority)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn previous_priority(this: &TaskPriorityChangeEvent) -> TaskPriority; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriorityChangeEventInit")] + #[wasm_bindgen(catch, constructor, js_class = "TaskPriorityChangeEvent")] + #[doc = "The `new TaskPriorityChangeEvent(..)` constructor, creating a new instance of `TaskPriorityChangeEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent/TaskPriorityChangeEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEvent`, `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + type_: &str, + priority_change_event_init_dict: &TaskPriorityChangeEventInit, + ) -> Result; +} diff --git a/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs new file mode 100644 index 000000000..9992965d1 --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs @@ -0,0 +1,118 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TaskPriorityChangeEventInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskPriorityChangeEventInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskPriorityChangeEventInit; +} +#[cfg(web_sys_unstable_apis)] +impl TaskPriorityChangeEventInit { + #[cfg(feature = "TaskPriority")] + #[doc = "Construct a new `TaskPriorityChangeEventInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(previous_priority: TaskPriority) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.previous_priority(previous_priority); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bubbles(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bubbles"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn cancelable(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("cancelable"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn composed(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("composed"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Change the `previousPriority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn previous_priority(&mut self, val: TaskPriority) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("previousPriority"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_TaskSignal.rs b/crates/web-sys/src/features/gen_TaskSignal.rs new file mode 100644 index 000000000..be9a55645 --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskSignal.rs @@ -0,0 +1,77 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = AbortSignal , extends = EventTarget , extends = :: js_sys :: Object , js_name = TaskSignal , typescript_type = "TaskSignal")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskSignal` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskSignal; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + # [wasm_bindgen (structural , method , getter , js_class = "TaskSignal" , js_name = priority)] + #[doc = "Getter for the `priority` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/priority)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn priority(this: &TaskSignal) -> TaskPriority; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "TaskSignal" , js_name = onprioritychange)] + #[doc = "Getter for the `onprioritychange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/onprioritychange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onprioritychange(this: &TaskSignal) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "TaskSignal" , js_name = onprioritychange)] + #[doc = "Setter for the `onprioritychange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/onprioritychange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onprioritychange(this: &TaskSignal, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (static_method_of = TaskSignal , js_class = "TaskSignal" , js_name = any)] + #[doc = "The `any()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/any)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn any(signals: &::wasm_bindgen::JsValue) -> TaskSignal; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskSignalAnyInit")] + # [wasm_bindgen (static_method_of = TaskSignal , js_class = "TaskSignal" , js_name = any)] + #[doc = "The `any()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/any)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`, `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn any_with_init(signals: &::wasm_bindgen::JsValue, init: &TaskSignalAnyInit) + -> TaskSignal; +} diff --git a/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs b/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs new file mode 100644 index 000000000..3a81c9682 --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs @@ -0,0 +1,58 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TaskSignalAnyInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskSignalAnyInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskSignalAnyInit; +} +#[cfg(web_sys_unstable_apis)] +impl TaskSignalAnyInit { + #[doc = "Construct a new `TaskSignalAnyInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn priority(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("priority"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for TaskSignalAnyInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 03b43db44..e7540b808 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -1938,6 +1938,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheStorage`, `Window`*"] pub fn caches(this: &Window) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Scheduler")] + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = scheduler)] + #[doc = "Getter for the `scheduler` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/scheduler)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scheduler(this: &Window) -> Scheduler; #[cfg(feature = "Storage")] # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = sessionStorage)] #[doc = "Getter for the `sessionStorage` field of this object."] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index e63bf3be9..df08803f5 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -123,6 +123,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheStorage`, `WorkerGlobalScope`*"] pub fn caches(this: &WorkerGlobalScope) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Scheduler")] + # [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = scheduler)] + #[doc = "Getter for the `scheduler` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/scheduler)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`, `WorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scheduler(this: &WorkerGlobalScope) -> Scheduler; # [wasm_bindgen (catch , method , structural , variadic , js_class = "WorkerGlobalScope" , js_name = importScripts)] #[doc = "The `importScripts()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 9ddcb4b26..2a27e7dfe 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -4210,6 +4210,12 @@ mod gen_IntlUtils; #[cfg(feature = "IntlUtils")] pub use gen_IntlUtils::*; +#[cfg(feature = "IsInputPendingOptions")] +#[allow(non_snake_case)] +mod gen_IsInputPendingOptions; +#[cfg(feature = "IsInputPendingOptions")] +pub use gen_IsInputPendingOptions::*; + #[cfg(feature = "IterableKeyAndValueResult")] #[allow(non_snake_case)] mod gen_IterableKeyAndValueResult; @@ -6592,6 +6598,24 @@ mod gen_RtcrtpStreamStats; #[cfg(feature = "RtcrtpStreamStats")] pub use gen_RtcrtpStreamStats::*; +#[cfg(feature = "Scheduler")] +#[allow(non_snake_case)] +mod gen_Scheduler; +#[cfg(feature = "Scheduler")] +pub use gen_Scheduler::*; + +#[cfg(feature = "SchedulerPostTaskOptions")] +#[allow(non_snake_case)] +mod gen_SchedulerPostTaskOptions; +#[cfg(feature = "SchedulerPostTaskOptions")] +pub use gen_SchedulerPostTaskOptions::*; + +#[cfg(feature = "Scheduling")] +#[allow(non_snake_case)] +mod gen_Scheduling; +#[cfg(feature = "Scheduling")] +pub use gen_Scheduling::*; + #[cfg(feature = "Screen")] #[allow(non_snake_case)] mod gen_Screen; @@ -7840,6 +7864,48 @@ mod gen_SvgtSpanElement; #[cfg(feature = "SvgtSpanElement")] pub use gen_SvgtSpanElement::*; +#[cfg(feature = "TaskController")] +#[allow(non_snake_case)] +mod gen_TaskController; +#[cfg(feature = "TaskController")] +pub use gen_TaskController::*; + +#[cfg(feature = "TaskControllerInit")] +#[allow(non_snake_case)] +mod gen_TaskControllerInit; +#[cfg(feature = "TaskControllerInit")] +pub use gen_TaskControllerInit::*; + +#[cfg(feature = "TaskPriority")] +#[allow(non_snake_case)] +mod gen_TaskPriority; +#[cfg(feature = "TaskPriority")] +pub use gen_TaskPriority::*; + +#[cfg(feature = "TaskPriorityChangeEvent")] +#[allow(non_snake_case)] +mod gen_TaskPriorityChangeEvent; +#[cfg(feature = "TaskPriorityChangeEvent")] +pub use gen_TaskPriorityChangeEvent::*; + +#[cfg(feature = "TaskPriorityChangeEventInit")] +#[allow(non_snake_case)] +mod gen_TaskPriorityChangeEventInit; +#[cfg(feature = "TaskPriorityChangeEventInit")] +pub use gen_TaskPriorityChangeEventInit::*; + +#[cfg(feature = "TaskSignal")] +#[allow(non_snake_case)] +mod gen_TaskSignal; +#[cfg(feature = "TaskSignal")] +pub use gen_TaskSignal::*; + +#[cfg(feature = "TaskSignalAnyInit")] +#[allow(non_snake_case)] +mod gen_TaskSignalAnyInit; +#[cfg(feature = "TaskSignalAnyInit")] +pub use gen_TaskSignalAnyInit::*; + #[cfg(feature = "TcpReadyState")] #[allow(non_snake_case)] mod gen_TcpReadyState; diff --git a/crates/web-sys/webidls/unstable/is-input-pending.webidl b/crates/web-sys/webidls/unstable/is-input-pending.webidl new file mode 100644 index 000000000..c29aaa455 --- /dev/null +++ b/crates/web-sys/webidls/unstable/is-input-pending.webidl @@ -0,0 +1,11 @@ +dictionary IsInputPendingOptions { + boolean includeContinuous = false; +}; + +[Exposed=Window] interface Scheduling { + boolean isInputPending(optional IsInputPendingOptions isInputPendingOptions = {}); +}; + +partial interface Navigator { + readonly attribute Scheduling scheduling; +}; diff --git a/crates/web-sys/webidls/unstable/scheduling-apis.webidl b/crates/web-sys/webidls/unstable/scheduling-apis.webidl new file mode 100644 index 000000000..ff8928151 --- /dev/null +++ b/crates/web-sys/webidls/unstable/scheduling-apis.webidl @@ -0,0 +1,58 @@ +enum TaskPriority { + "user-blocking", + "user-visible", + "background" +}; + +dictionary SchedulerPostTaskOptions { + AbortSignal signal; + TaskPriority priority; + [EnforceRange] unsigned long long delay = 0; +}; + +callback SchedulerPostTaskCallback = any (); + +[Exposed=(Window, Worker)] +interface Scheduler { + Promise postTask(SchedulerPostTaskCallback callback, + optional SchedulerPostTaskOptions options = {}); +}; + +[Exposed=(Window, Worker)] +interface TaskPriorityChangeEvent : Event { + constructor(DOMString type, TaskPriorityChangeEventInit priorityChangeEventInitDict); + + readonly attribute TaskPriority previousPriority; +}; + +dictionary TaskPriorityChangeEventInit : EventInit { + required TaskPriority previousPriority; +}; + +dictionary TaskControllerInit { + TaskPriority priority = "user-visible"; +}; + +[Exposed=(Window,Worker)] +interface TaskController : AbortController { + constructor(optional TaskControllerInit init = {}); + + undefined setPriority(TaskPriority priority); +}; + +dictionary TaskSignalAnyInit { + (TaskPriority or TaskSignal) priority = "user-visible"; +}; + +[Exposed=(Window, Worker)] +interface TaskSignal : AbortSignal { + [NewObject] static TaskSignal _any(sequence signals, optional TaskSignalAnyInit init = {}); + + readonly attribute TaskPriority priority; + + attribute EventHandler onprioritychange; +}; + +partial interface mixin WindowOrWorkerGlobalScope { + [Replaceable] readonly attribute Scheduler scheduler; +};