-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prioritized Task Scheduling API (#3566)
- Loading branch information
Showing
19 changed files
with
858 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
95 changes: 95 additions & 0 deletions
95
crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
Oops, something went wrong.