HTML5: Add support for Input.vibrate_handheld()

This commit is contained in:
pattlebass 2022-07-27 15:35:01 +03:00
parent 47edfa8769
commit 130e715ab9
6 changed files with 20 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');