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:
parent
2665923bb0
commit
3dba261ae7
5 changed files with 23 additions and 22 deletions
|
@ -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;
|
||||
});
|
3
src/components/apiInput/package.json
Normal file
3
src/components/apiInput/package.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"main": "apiInput.js"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue