1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

[3.x] HTML5: Add support for Input.vibrate_handheld()

This commit is contained in:
pattlebass
2022-07-27 13:51:40 +03:00
parent 516d6b6bad
commit fb7ecc748f
6 changed files with 19 additions and 2 deletions

View File

@@ -534,6 +534,15 @@ const GodotInput = {
GodotRuntime.free(ptr);
}, false);
},
godot_js_input_vibrate_handheld__sig: 'vi',
godot_js_input_vibrate_handheld: function (p_duration_ms) {
if (typeof navigator.vibrate !== 'function') {
GodotRuntime.print('This browser does not support vibration.');
} else {
navigator.vibrate(p_duration_ms);
}
},
};
autoAddDeps(GodotInput, '$GodotInput');