mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-05 22:30:29 +00:00
Fix web joystick vibration (again)
(cherry picked from commit 96c03dc66e)
This commit is contained in:
parent
825d6f8232
commit
c2567e5db5
1 changed files with 2 additions and 2 deletions
|
|
@ -506,7 +506,7 @@ static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
|||
|
||||
item->rumble_available = MAIN_THREAD_EM_ASM_INT({
|
||||
let gamepad = navigator['getGamepads']()[$0];
|
||||
return gamepad && gamepad['vibrationActuator']; // Don't check the vibrationActuator.effects array here, because it's not defined in Safari
|
||||
return gamepad && 'vibrationActuator' in gamepad; // Don't check the vibrationActuator.effects array here, because it's not defined in Safari
|
||||
}, item->index);
|
||||
|
||||
if (item->rumble_available) {
|
||||
|
|
@ -516,7 +516,7 @@ static bool EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
|||
item->trigger_rumble_available = MAIN_THREAD_EM_ASM_INT({
|
||||
let gamepad = navigator['getGamepads']()[$0];
|
||||
// This effect is not supported in Safari, so it's okay for us to check the vibrationActuator.effects array here for the browsers that do support it
|
||||
return gamepad && gamepad['vibrationActuator'] && gamepad['vibrationActuator']['effects'] && gamepad['vibrationActuator']['effects']['includes']('trigger-rumble');
|
||||
return gamepad && 'vibrationActuator' in gamepad && 'effects' in gamepad['vibrationActuator'] && gamepad['vibrationActuator']['effects']['includes']('trigger-rumble');
|
||||
}, item->index);
|
||||
|
||||
if (item->trigger_rumble_available) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue