Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add deviceMemory to Navigator IDL #4011

Merged
merged 4 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
* Added the `thread_stack_size` property to the object parameter of `default()` (`init()`) and `initSync()`, making it possible to set the stack size of spawned threads. `__wbindgen_thread_destroy()` now has a third optional parameter for the stack size, the default stack size is assumed when not passing it. When calling from the thread to be destroyed, by passing no parameters, the correct stack size is determined internally.
[#3995](https://github.com/rustwasm/wasm-bindgen/pull/3995)

* Added bindings to the Device Memory API.
[#4011](https://github.com/rustwasm/wasm-bindgen/pull/4011)

### Changed

* Stabilize Web Share API.
Expand Down
11 changes: 11 additions & 0 deletions crates/web-sys/src/features/gen_Navigator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,17 @@ extern "C" {
#[doc = "*This API requires the following crate features to be activated: `Navigator`*"]
pub fn hardware_concurrency(this: &Navigator) -> f64;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = deviceMemory)]
#[doc = "Getter for the `deviceMemory` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Navigator`*"]
#[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 device_memory(this: &Navigator) -> f64;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "Gpu")]
# [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = gpu)]
#[doc = "Getter for the `gpu` field of this object."]
Expand Down
11 changes: 11 additions & 0 deletions crates/web-sys/src/features/gen_WorkerNavigator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ extern "C" {
#[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"]
pub fn hardware_concurrency(this: &WorkerNavigator) -> f64;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = deviceMemory)]
#[doc = "Getter for the `deviceMemory` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/deviceMemory)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"]
#[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 device_memory(this: &WorkerNavigator) -> f64;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "Gpu")]
# [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = gpu)]
#[doc = "Getter for the `gpu` field of this object."]
Expand Down
11 changes: 11 additions & 0 deletions crates/web-sys/webidls/unstable/DeviceMemory.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// https://www.w3.org/TR/2022/WD-device-memory-1-20220722

[
SecureContext,
Exposed=(Window,Worker)
] interface mixin NavigatorDeviceMemory {
readonly attribute double deviceMemory;
};

Navigator includes NavigatorDeviceMemory;
WorkerNavigator includes NavigatorDeviceMemory;