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

Add bindings for UserActivation #3719

Merged
merged 1 commit into from
Nov 28, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
};