Table of Contents

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

This interface is accessible through the HapticActuators property.

-Gamepad API

See also on MDN

Constructors

GamepadHapticActuator()

public GamepadHapticActuator()

Properties

Effects

NOTE
Experimental
The effects 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

type GamepadHapticEffectType
params_ GamepadEffectParameters

Returns

Task<GamepadHapticsResult>

A promise that resolves with &quot;complete&quot; when the effect successfully completes, or &quot;preempted&quot; 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

value Number
duration Number

Returns

Task<bool>

A promise that resolves with a value of true when the pulse has successfully completed.

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 &quot;complete&quot; if the effect is successfully reset, or &quot;preempted&quot; if the effect was stopped or replaced by another effect.The promise may reject with the following exception types:

Remarks