Skip to content

Commit

Permalink
Add WorkerGlobalScope.performance
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Jul 5, 2023
1 parent 03ae219 commit 7d4a5ec
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -20,6 +20,9 @@
* Add bindings for async variants of `Atomics.wait`.
[#3504](https://github.com/rustwasm/wasm-bindgen/pull/3504)

* Add bindings for `WorkerGlobalScope.performance`.
[#3506](https://github.com/rustwasm/wasm-bindgen/pull/3506)

### Changed

* Updated the WebGPU WebIDL.
Expand Down
16 changes: 8 additions & 8 deletions crates/web-sys/src/features/gen_Window.rs
Expand Up @@ -355,14 +355,6 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Window`*"]
pub fn device_pixel_ratio(this: &Window) -> f64;
#[cfg(feature = "Performance")]
# [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = performance)]
#[doc = "Getter for the `performance` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/performance)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Performance`, `Window`*"]
pub fn performance(this: &Window) -> Option<Performance>;
# [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = orientation)]
#[doc = "Getter for the `orientation` field of this object."]
#[doc = ""]
Expand Down Expand Up @@ -1908,6 +1900,14 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Storage`, `Window`*"]
pub fn local_storage(this: &Window) -> Result<Option<Storage>, JsValue>;
#[cfg(feature = "Performance")]
# [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = performance)]
#[doc = "Getter for the `performance` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/performance)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Performance`, `Window`*"]
pub fn performance(this: &Window) -> Option<Performance>;
# [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = origin)]
#[doc = "Getter for the `origin` field of this object."]
#[doc = ""]
Expand Down
8 changes: 8 additions & 0 deletions crates/web-sys/src/features/gen_WorkerGlobalScope.rs
Expand Up @@ -85,6 +85,14 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Crypto`, `WorkerGlobalScope`*"]
pub fn crypto(this: &WorkerGlobalScope) -> Result<Crypto, JsValue>;
#[cfg(feature = "Performance")]
# [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = performance)]
#[doc = "Getter for the `performance` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/performance)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Performance`, `WorkerGlobalScope`*"]
pub fn performance(this: &WorkerGlobalScope) -> Option<Performance>;
# [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = origin)]
#[doc = "Getter for the `origin` field of this object."]
#[doc = ""]
Expand Down
6 changes: 3 additions & 3 deletions crates/web-sys/webidls/enabled/Window.webidl
Expand Up @@ -195,9 +195,9 @@ partial interface Window {
[Replaceable] readonly attribute double devicePixelRatio;
};

// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
partial interface Window {
[Replaceable, Pure, StoreInSlot] readonly attribute Performance? performance;
// https://w3c.github.io/hr-time/#the-performance-attribute
partial interface mixin WindowOrWorkerGlobalScope {
[Replaceable] readonly attribute Performance? performance;
};

// https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
Expand Down

0 comments on commit 7d4a5ec

Please sign in to comment.