Prioritized Task Scheduling API (#3566)

This commit is contained in:
daxpedda 2023-08-25 11:39:33 +02:00 committed by GitHub
parent f906f6dad6
commit 6788a8fb15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 858 additions and 0 deletions

View File

@ -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.

View File

@ -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"]

View File

@ -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()
}
}

View File

@ -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 = ""]

View File

@ -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;
}

View File

@ -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()
}
}

View File

@ -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;
}

View File

@ -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<TaskController, JsValue>;
#[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<TaskController, JsValue>;
#[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);
}

View File

@ -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()
}
}

View File

@ -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",
}

View File

@ -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<TaskPriorityChangeEvent, JsValue>;
}

View File

@ -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
}
}

View File

@ -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;
}

View File

@ -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()
}
}

View File

@ -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<CacheStorage, JsValue>;
#[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."]

View File

@ -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<CacheStorage, JsValue>;
#[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 = ""]

View File

@ -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;

View File

@ -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;
};

View File

@ -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<any> 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<AbortSignal> signals, optional TaskSignalAnyInit init = {});
readonly attribute TaskPriority priority;
attribute EventHandler onprioritychange;
};
partial interface mixin WindowOrWorkerGlobalScope {
[Replaceable] readonly attribute Scheduler scheduler;
};