gamepad.idl (2192B)
1 // GENERATED CONTENT - DO NOT EDIT 2 // Content was automatically extracted by Reffy into webref 3 // (https://github.com/w3c/webref) 4 // Source: Gamepad (https://w3c.github.io/gamepad/) 5 6 [Exposed=Window] 7 interface Gamepad { 8 readonly attribute DOMString id; 9 readonly attribute long index; 10 readonly attribute boolean connected; 11 readonly attribute DOMHighResTimeStamp timestamp; 12 readonly attribute GamepadMappingType mapping; 13 readonly attribute FrozenArray<double> axes; 14 readonly attribute FrozenArray<GamepadButton> buttons; 15 readonly attribute FrozenArray<GamepadTouch> touches; 16 [SameObject] readonly attribute GamepadHapticActuator vibrationActuator; 17 }; 18 19 [Exposed=Window] 20 interface GamepadButton { 21 readonly attribute boolean pressed; 22 readonly attribute boolean touched; 23 readonly attribute double value; 24 }; 25 26 dictionary GamepadTouch { 27 unsigned long touchId; 28 octet surfaceId; 29 DOMPointReadOnly position; 30 DOMRectReadOnly? surfaceDimensions; 31 }; 32 33 enum GamepadMappingType { 34 "", 35 "standard", 36 "xr-standard", 37 }; 38 39 [Exposed=Window] 40 interface GamepadHapticActuator { 41 [SameObject] readonly attribute FrozenArray<GamepadHapticEffectType> effects; 42 Promise<GamepadHapticsResult> playEffect( 43 GamepadHapticEffectType type, 44 optional GamepadEffectParameters params = {} 45 ); 46 Promise<GamepadHapticsResult> reset(); 47 }; 48 49 enum GamepadHapticsResult { 50 "complete", 51 "preempted" 52 }; 53 54 enum GamepadHapticEffectType { 55 "dual-rumble", 56 "trigger-rumble" 57 }; 58 59 dictionary GamepadEffectParameters { 60 unsigned long long duration = 0; 61 unsigned long long startDelay = 0; 62 double strongMagnitude = 0.0; 63 double weakMagnitude = 0.0; 64 double leftTrigger = 0.0; 65 double rightTrigger = 0.0; 66 }; 67 68 [Exposed=Window] 69 partial interface Navigator { 70 sequence<Gamepad?> getGamepads(); 71 }; 72 73 [Exposed=Window] 74 75 interface GamepadEvent: Event { 76 constructor(DOMString type, GamepadEventInit eventInitDict); 77 [SameObject] readonly attribute Gamepad gamepad; 78 }; 79 80 dictionary GamepadEventInit : EventInit { 81 required Gamepad gamepad; 82 }; 83 84 partial interface mixin WindowEventHandlers { 85 attribute EventHandler ongamepadconnected; 86 attribute EventHandler ongamepaddisconnected; 87 };