Class GamepadHapticActuator
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The GamepadHapticActuator interface of the Gamepad API represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware.
[Value("GamepadHapticActuator")]
public class GamepadHapticActuator
- Inheritance
-
GamepadHapticActuator
- Inherited Members
Remarks
Constructors
GamepadHapticActuator()
public GamepadHapticActuator()
Properties
Effects
NOTE
Experimentaleffects read-only property of the GamepadHapticActuator interface returns an array of enumerated values representing the different haptic effects that the actuator supports.
[Value("effects")]
public GamepadHapticEffectType[] Effects { get; }
Property Value
- GamepadHapticEffectType[]
An array representing the supported haptic effects. Possible included values are:
NOTE
If an effect is not listed that is known to be supported by the hardware, it may be that the browser does not support playing effects of that type.
Remarks
Methods
PlayEffect(GamepadHapticEffectType, GamepadEffectParameters)
The playEffect() method of the GamepadHapticActuator interface causes the hardware to play a specific vibration effect.
[Value("playEffect")]
public Task<GamepadHapticsResult> PlayEffect(GamepadHapticEffectType type, GamepadEffectParameters params_ = null)
Parameters
typeGamepadHapticEffectTypeparams_GamepadEffectParameters
Returns
- Task<GamepadHapticsResult>
A promise that resolves with
"complete"when the effect successfully completes, or"preempted"if the current effect is stopped or replaced by another effect.The promise may reject with the following exception types:
Remarks
Pulse(Number, Number)
The pulse() method of the GamepadHapticActuator interface makes the hardware pulse at a certain intensity for a specified duration.
[Value("pulse")]
public Task<bool> Pulse(Number value, Number duration)
Parameters
Returns
Remarks
Reset()
The reset() method of the GamepadHapticActuator interface stops the hardware from playing an active vibration effect.
[Value("reset")]
public Task<GamepadHapticsResult> Reset()
Returns
- Task<GamepadHapticsResult>
A promise that resolves with
"complete"if the effect is successfully reset, or"preempted"if the effect was stopped or replaced by another effect.The promise may reject with the following exception types: