mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Convert inputManager to ES6
This commit is contained in:
parent
43f6f985aa
commit
e5c8d2b23b
2 changed files with 27 additions and 20 deletions
|
@ -92,7 +92,8 @@
|
||||||
"src/components/sanatizefilename.js",
|
"src/components/sanatizefilename.js",
|
||||||
"src/scripts/settings/webSettings.js",
|
"src/scripts/settings/webSettings.js",
|
||||||
"src/components/scrollManager.js",
|
"src/components/scrollManager.js",
|
||||||
"src/scripts/dfnshelper.js"
|
"src/scripts/dfnshelper.js",
|
||||||
|
"src/scripts/inputManager.js"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@babel/plugin-transform-modules-amd"
|
"@babel/plugin-transform-modules-amd"
|
||||||
|
|
|
@ -1,32 +1,37 @@
|
||||||
define(['playbackManager', 'focusManager', 'appRouter', 'dom', 'apphost'], function (playbackManager, focusManager, appRouter, dom, appHost) {
|
import playbackManager from 'playbackManager';
|
||||||
'use strict';
|
import focusManager from 'focusManager';
|
||||||
|
import appRouter from 'appRouter';
|
||||||
|
import dom from 'dom';
|
||||||
|
import appHost from 'apphost';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
var lastInputTime = new Date().getTime();
|
var lastInputTime = new Date().getTime();
|
||||||
|
|
||||||
function notify() {
|
export function notify() {
|
||||||
lastInputTime = new Date().getTime();
|
lastInputTime = new Date().getTime();
|
||||||
handleCommand('unknown');
|
handleCommand('unknown');
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifyMouseMove() {
|
export function notifyMouseMove() {
|
||||||
lastInputTime = new Date().getTime();
|
lastInputTime = new Date().getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
function idleTime() {
|
export function idleTime() {
|
||||||
return new Date().getTime() - lastInputTime;
|
return new Date().getTime() - lastInputTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
function select(sourceElement) {
|
export function select(sourceElement) {
|
||||||
sourceElement.click();
|
sourceElement.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventListenerCount = 0;
|
var eventListenerCount = 0;
|
||||||
function on(scope, fn) {
|
export function on(scope, fn) {
|
||||||
eventListenerCount++;
|
eventListenerCount++;
|
||||||
dom.addEventListener(scope, 'command', fn, {});
|
dom.addEventListener(scope, 'command', fn, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function off(scope, fn) {
|
export function off(scope, fn) {
|
||||||
if (eventListenerCount) {
|
if (eventListenerCount) {
|
||||||
eventListenerCount--;
|
eventListenerCount--;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +53,7 @@ define(['playbackManager', 'focusManager', 'appRouter', 'dom', 'apphost'], funct
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCommand(commandName, options) {
|
export function handleCommand(commandName, options) {
|
||||||
|
|
||||||
lastInputTime = new Date().getTime();
|
lastInputTime = new Date().getTime();
|
||||||
|
|
||||||
|
@ -147,13 +152,14 @@ define(['playbackManager', 'focusManager', 'appRouter', 'dom', 'apphost'], funct
|
||||||
passive: true
|
passive: true
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
/* eslint-enable indent */
|
||||||
trigger: handleCommand,
|
|
||||||
handle: handleCommand,
|
export default {
|
||||||
notify: notify,
|
trigger: handleCommand,
|
||||||
notifyMouseMove: notifyMouseMove,
|
handle: handleCommand,
|
||||||
idleTime: idleTime,
|
notify: notify,
|
||||||
on: on,
|
notifyMouseMove: notifyMouseMove,
|
||||||
off: off
|
idleTime: idleTime,
|
||||||
};
|
on: on,
|
||||||
});
|
off: off
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue