chromium/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.idl

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://www.w3.org/TR/gamepad/#gamepadhapticeffecttype-enum
enum GamepadHapticActuatorType {
    "vibration",
    "dual-rumble"
};

enum GamepadHapticEffectType {
    "dual-rumble",
    "trigger-rumble"
};

enum GamepadHapticsResult {
    "complete",
    "preempted",
    "invalid-parameter",
    "not-supported"
};

// https://www.w3.org/TR/gamepad/#gamepadhapticactuator-interface
[
    Exposed=Window
] interface GamepadHapticActuator {
    [SameObject] readonly attribute FrozenArray<GamepadHapticEffectType> effects;
    [MeasureAs=GamepadHapticActuatorType] readonly attribute GamepadHapticActuatorType type;
    [CallWith=ScriptState] Promise<GamepadHapticsResult> playEffect(
        GamepadHapticEffectType type,
        GamepadEffectParameters params);
    [CallWith=ScriptState] Promise<GamepadHapticsResult> reset();
};