Function rename

This commit is contained in:
ferferga 2020-03-03 17:56:59 +01:00
parent 3310d5b239
commit c8836c61f3

View File

@ -372,14 +372,14 @@ require(['apphost'], function (appHost) {
return false; return false;
} }
function attachGamepad(e) { function onFocusOrGamepadAttach(e) {
if (isGamepadConnected() && document.hasFocus()) { if (isGamepadConnected() && document.hasFocus()) {
console.log("Gamepad connected! Starting input loop"); console.log("Gamepad connected! Starting input loop");
startInputLoop(); startInputLoop();
} }
} }
function dettachGamepad(e) { function onFocusOrGamepadDetach(e) {
if (!isGamepadConnected() || !document.hasFocus()) { if (!isGamepadConnected() || !document.hasFocus()) {
console.log("Gamepad disconnected! No other gamepads are connected, stopping input loop"); console.log("Gamepad disconnected! No other gamepads are connected, stopping input loop");
stopInputLoop(); stopInputLoop();
@ -389,12 +389,12 @@ require(['apphost'], function (appHost) {
} }
// Event listeners for any change in gamepads' state. // Event listeners for any change in gamepads' state.
window.addEventListener("gamepaddisconnected", dettachGamepad); window.addEventListener("gamepaddisconnected", onFocusOrGamepadDetach);
window.addEventListener("gamepadconnected", attachGamepad); window.addEventListener("gamepadconnected", onFocusOrGamepadAttach);
window.addEventListener("blur", dettachGamepad); window.addEventListener("blur", onFocusOrGamepadDetach);
window.addEventListener("focus", attachGamepad); window.addEventListener("focus", onFocusOrGamepadAttach);
attachGamepad(); onFocusOrGamepadAttach();
// The gamepadInputEmulation is a string property that exists in JavaScript UWAs and in WebViews in UWAs. // The gamepadInputEmulation is a string property that exists in JavaScript UWAs and in WebViews in UWAs.
// It won't exist in Win8.1 style apps or browsers. // It won't exist in Win8.1 style apps or browsers.