Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Joystick: add try/catch around navigator.getGamepads() because it mig…
…ht throw a JS SecurityError if we don't have permission to call it (#1728) Fixes the following exception when we don't have permissions: > Failed to execute 'getGamepads' on 'Navigator': Access to the feature "gamepad" is disallowed by permissions policy. By catching the exception, it should now behave the same as older browsers, where navigator.getGamepads() doesn't exist at all. In the future, it might make sense to set a flag if navigator.getGamepads() throws, and skip calling it more than once. However, we may want to listen for some kind of browser event that indicates that permission was granted later, and clear the flag when appropriate. Perhaps the gamepadconnected event? --------- Co-authored-by: Josh Tynjala <[email protected]>
- Loading branch information