| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // https://w3c.github.io/gamepad/extensions.html#gamepadhapticactuatortype-enum |
| enum GamepadHapticActuatorType { |
| "vibration", |
| "dual-rumble" |
| }; |
| |
| enum GamepadHapticEffectType { |
| "dual-rumble" |
| }; |
| |
| enum GamepadHapticsResult { |
| "complete", |
| "preempted", |
| "invalid-parameter", |
| "not-supported" |
| }; |
| |
| // Gamepad vibration is proposed as an extension to the Gamepad API. |
| // https://github.com/w3c/gamepad/pull/68 |
| [ |
| RuntimeEnabled=GamepadVibration |
| ] interface GamepadHapticActuator { |
| readonly attribute GamepadHapticActuatorType type; |
| [CallWith=ScriptState] Promise<GamepadHapticsResult> playEffect( |
| GamepadHapticEffectType type, |
| GamepadEffectParameters params); |
| [CallWith=ScriptState] Promise<GamepadHapticsResult> reset(); |
| }; |