- From: Marcos Cáceres <notifications@github.com>
- Date: Wed, 22 Jun 2022 22:01:49 -0700
- To: w3c/gamepad <gamepad@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 23 June 2022 05:02:02 UTC
@marcoscaceres commented on this pull request. > </p> <pre class="idl"> [Exposed=Window] interface GamepadHapticActuator { readonly attribute GamepadHapticActuatorType type; + boolean canPlayEffectType(GamepadHapticEffectType type); To future-proof this, this should take a `DOMString`, not a enum value. Otherwise, this will throw. The logic here being that you should be able to do: ```JS const myGamesEffects = ["rumble", "bumble", "trigger-me-fumble", "dual-rumble", "pulse"]; // This shouldn't throw... "trigger-me-fumble" is supported in FutureBrowser 2000! const supportedEffects = myGamesEffects.filter(effect => gamepad.actuator.vibrationActuator.canPlay(effect)); ``` Alternatively, why not just ask the `vibrationActuator` to return what it supports via a frozen array? Then there is no need to keep asking the gamepad what it can do. ```JS gamepad.actuator.vibrationActuator.effects.includes("dual-rumble") ``` -- Reply to this email directly or view it on GitHub: https://github.com/w3c/gamepad/pull/163#discussion_r904520904 You are receiving this because you are subscribed to this thread. Message ID: <w3c/gamepad/pull/163/review/1016335005@github.com>
Received on Thursday, 23 June 2022 05:02:02 UTC