Skip to content

Commit

Permalink
Add bindings for UserActivation
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Nov 28, 2023
1 parent 3b88093 commit d5597c3
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

## [Unreleased](https://github.com/rustwasm/wasm-bindgen/compare/0.2.89...main)

### Added

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

### Removed

* Removed Gecko-only `InstallTriggerData` and Gecko-internal `FlexLineGrowthState`, `GridDeclaration`, `GridTrackState`,
Expand Down
1 change: 1 addition & 0 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@ UsbPermissionStorage = []
UsbRecipient = []
UsbRequestType = []
UsbTransferStatus = []
UserActivation = []
UserProximityEvent = ["Event"]
UserProximityEventInit = []
UserVerificationRequirement = []
Expand Down
8 changes: 8 additions & 0 deletions crates/web-sys/src/features/gen_Navigator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `CredentialsContainer`, `Navigator`*"]
pub fn credentials(this: &Navigator) -> CredentialsContainer;
#[cfg(feature = "UserActivation")]
# [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = userActivation)]
#[doc = "Getter for the `userActivation` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userActivation)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Navigator`, `UserActivation`*"]
pub fn user_activation(this: &Navigator) -> UserActivation;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "Bluetooth")]
# [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = bluetooth)]
Expand Down
29 changes: 29 additions & 0 deletions crates/web-sys/src/features/gen_UserActivation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = UserActivation , typescript_type = "UserActivation")]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `UserActivation` class."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/UserActivation)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UserActivation`*"]
pub type UserActivation;
# [wasm_bindgen (structural , method , getter , js_class = "UserActivation" , js_name = hasBeenActive)]
#[doc = "Getter for the `hasBeenActive` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/UserActivation/hasBeenActive)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UserActivation`*"]
pub fn has_been_active(this: &UserActivation) -> bool;
# [wasm_bindgen (structural , method , getter , js_class = "UserActivation" , js_name = isActive)]
#[doc = "Getter for the `isActive` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/UserActivation/isActive)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UserActivation`*"]
pub fn is_active(this: &UserActivation) -> bool;
}
6 changes: 6 additions & 0 deletions crates/web-sys/src/features/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8350,6 +8350,12 @@ mod gen_UsbTransferStatus;
#[cfg(feature = "UsbTransferStatus")]
pub use gen_UsbTransferStatus::*;

#[cfg(feature = "UserActivation")]
#[allow(non_snake_case)]
mod gen_UserActivation;
#[cfg(feature = "UserActivation")]
pub use gen_UserActivation::*;

#[cfg(feature = "UserProximityEvent")]
#[allow(non_snake_case)]
mod gen_UserProximityEvent;
Expand Down
9 changes: 9 additions & 0 deletions crates/web-sys/webidls/enabled/UserActivation.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Exposed=Window]
interface UserActivation {
readonly attribute boolean hasBeenActive;
readonly attribute boolean isActive;
};

partial interface Navigator {
[SameObject] readonly attribute UserActivation userActivation;
};

0 comments on commit d5597c3

Please sign in to comment.