summaryrefslogtreecommitdiff
path: root/platform/javascript/js
diff options
context:
space:
mode:
authorpattlebass <49322676+pattlebass@users.noreply.github.com>2022-07-27 15:35:01 +0300
committerpattlebass <49322676+pattlebass@users.noreply.github.com>2022-07-27 22:54:41 +0300
commit130e715ab9a86c7363424e25df85e68ab52e85ec (patch)
tree2c2baae8a108b3ca39d20c50948923e3efe0b73b /platform/javascript/js
parent47edfa876908408828cd3b120b32e274d646ab8b (diff)
HTML5: Add support for `Input.vibrate_handheld()`
Diffstat (limited to 'platform/javascript/js')
-rw-r--r--platform/javascript/js/libs/library_godot_input.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/javascript/js/libs/library_godot_input.js b/platform/javascript/js/libs/library_godot_input.js
index 1e64c260f8..51571d64a2 100644
--- a/platform/javascript/js/libs/library_godot_input.js
+++ b/platform/javascript/js/libs/library_godot_input.js
@@ -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');