Skip to content

Commit

Permalink
Update Gamepad API (#4134)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Sep 28, 2024
1 parent 7346058 commit 4765448
Show file tree
Hide file tree
Showing 29 changed files with 695 additions and 758 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
* Implicitly enable reference type and multivalue transformations if the module already makes use of the corresponding target features.
[#4133](https://github.com/rustwasm/wasm-bindgen/pull/4133)

* Updated Gamepad API.
[#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134)

* Deprecated `Gamepad::display_id` and `GamepadHapticActuator::type_`.
[#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134)

* Removed `GamepadAxisMoveEvent`, `GamepadAxisMoveEventInit`, `GamepadButtonEvent`, `GamepadButtonEventInit` and `GamepadServiceTest`, which were seemingly never implemented by any JS environment.
[#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134)

### Fixed

* Fixed linked modules emitting snippet files when not using `--split-linked-modules`.
Expand Down
9 changes: 4 additions & 5 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -454,19 +454,18 @@ FuzzingFunctions = []
GainNode = ["AudioNode", "EventTarget"]
GainOptions = []
Gamepad = []
GamepadAxisMoveEvent = ["Event", "GamepadEvent"]
GamepadAxisMoveEventInit = []
GamepadButton = []
GamepadButtonEvent = ["Event", "GamepadEvent"]
GamepadButtonEventInit = []
GamepadEffectParameters = []
GamepadEvent = ["Event"]
GamepadEventInit = []
GamepadHand = []
GamepadHapticActuator = []
GamepadHapticActuatorType = []
GamepadHapticEffectType = []
GamepadHapticsResult = []
GamepadMappingType = []
GamepadPose = []
GamepadServiceTest = []
GamepadTouch = []
Geolocation = []
GetAnimationsOptions = []
GetRootNodeOptions = []
Expand Down
86 changes: 55 additions & 31 deletions crates/web-sys/src/features/gen_Gamepad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn index(this: &Gamepad) -> u32;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = connected)]
#[doc = "Getter for the `connected` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/connected)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn connected(this: &Gamepad) -> bool;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = timestamp)]
#[doc = "Getter for the `timestamp` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/timestamp)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn timestamp(this: &Gamepad) -> f64;
#[cfg(feature = "GamepadMappingType")]
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = mapping)]
#[doc = "Getter for the `mapping` field of this object."]
Expand All @@ -34,49 +48,43 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadMappingType`*"]
pub fn mapping(this: &Gamepad) -> GamepadMappingType;
#[cfg(feature = "GamepadHand")]
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hand)]
#[doc = "Getter for the `hand` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hand)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadHand`*"]
pub fn hand(this: &Gamepad) -> GamepadHand;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = displayId)]
#[doc = "Getter for the `displayId` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/displayId)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn display_id(this: &Gamepad) -> u32;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = connected)]
#[doc = "Getter for the `connected` field of this object."]
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = axes)]
#[doc = "Getter for the `axes` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/connected)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn connected(this: &Gamepad) -> bool;
pub fn axes(this: &Gamepad) -> ::js_sys::Array;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = buttons)]
#[doc = "Getter for the `buttons` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/buttons)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn buttons(this: &Gamepad) -> ::js_sys::Array;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = axes)]
#[doc = "Getter for the `axes` field of this object."]
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = displayId)]
#[doc = "Getter for the `displayId` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/displayId)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn axes(this: &Gamepad) -> ::js_sys::Array;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = timestamp)]
#[doc = "Getter for the `timestamp` field of this object."]
#[deprecated]
pub fn display_id(this: &Gamepad) -> u32;
#[cfg(feature = "GamepadHand")]
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hand)]
#[doc = "Getter for the `hand` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/timestamp)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hand)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadHand`*"]
pub fn hand(this: &Gamepad) -> GamepadHand;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hapticActuators)]
#[doc = "Getter for the `hapticActuators` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hapticActuators)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn timestamp(this: &Gamepad) -> f64;
pub fn haptic_actuators(this: &Gamepad) -> ::js_sys::Array;
#[cfg(feature = "GamepadPose")]
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = pose)]
#[doc = "Getter for the `pose` field of this object."]
Expand All @@ -85,11 +93,27 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadPose`*"]
pub fn pose(this: &Gamepad) -> Option<GamepadPose>;
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hapticActuators)]
#[doc = "Getter for the `hapticActuators` field of this object."]
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GamepadHapticActuator")]
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = vibrationActuator)]
#[doc = "Getter for the `vibrationActuator` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hapticActuators)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/vibrationActuator)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadHapticActuator`*"]
#[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 vibration_actuator(this: &Gamepad) -> GamepadHapticActuator;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = touchEvents)]
#[doc = "Getter for the `touchEvents` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/touchEvents)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gamepad`*"]
pub fn haptic_actuators(this: &Gamepad) -> ::js_sys::Array;
#[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 touch_events(this: &Gamepad) -> Option<::js_sys::Array>;
}
47 changes: 0 additions & 47 deletions crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs

This file was deleted.

121 changes: 0 additions & 121 deletions crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs

This file was deleted.

40 changes: 0 additions & 40 deletions crates/web-sys/src/features/gen_GamepadButtonEvent.rs

This file was deleted.

Loading

0 comments on commit 4765448

Please sign in to comment.