1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

define apiInput as a module for webpack

This commit is contained in:
vitorsemeano 2019-02-23 19:34:34 +00:00
parent 2665923bb0
commit 3dba261ae7
5 changed files with 23 additions and 22 deletions

View file

@ -234,6 +234,19 @@ define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focus
events.on(apiClient, "message", onMessageReceived);
}
function enableNativeGamepadKeyMapping() {
if (!(!window.navigator || "string" != typeof window.navigator.gamepadInputEmulation)) {
window.navigator.gamepadInputEmulation = "keyboard";
return true;
}
return false;
}
function isGamepadSupported() {
return "ongamepadconnected" in window || navigator.getGamepads || navigator.webkitGetGamepads;
}
connectionManager.getApiClients().forEach(bindEvents);
events.on(connectionManager, 'apiclientcreated', function (e, newApiClient) {
@ -241,5 +254,11 @@ define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focus
bindEvents(newApiClient);
});
if (!enableNativeGamepadKeyMapping() && isGamepadSupported()) {
require(["components/apiInput/gamepadtokey"]);
}
require(["components/apiInput/mouseManager"]);
return serverNotifications;
});

View file

@ -0,0 +1,3 @@
{
"main": "apiInput.js"
}