Merge pull request #4050 from thornbill/apiclient-events

Replace apiclient event bus with local version
This commit is contained in:
Bill Thornton 2022-10-14 17:09:35 -04:00 committed by GitHub
commit 1762e95740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 159 additions and 91 deletions

View File

@ -1,7 +1,8 @@
import { ConnectionManager, Credentials, ApiClient, Events } from 'jellyfin-apiclient';
import { ConnectionManager, Credentials, ApiClient } from 'jellyfin-apiclient';
import { appHost } from './apphost';
import Dashboard from '../utils/dashboard';
import Events from '../utils/events.ts';
import { setUserInfo } from '../scripts/settings/userSettings';
import appSettings from '../scripts/settings/appSettings';

View File

@ -1,5 +1,5 @@
import escapeHtml from 'escape-html';
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
import globalize from '../scripts/globalize';
import dom from '../scripts/dom';
import * as datefns from 'date-fns';

View File

@ -1,9 +1,9 @@
import { Events } from 'jellyfin-apiclient';
import { Action, createHashHistory } from 'history';
import { appHost } from './apphost';
import { clearBackdrop, setBackdropTransparency } from './backdrop/backdrop';
import globalize from '../scripts/globalize';
import Events from '../utils/events.ts';
import itemHelper from './itemHelper';
import loading from './loading/loading';
import viewManager from './viewManager/viewManager';

View File

@ -1,7 +1,7 @@
import Package from '../../package.json';
import appSettings from '../scripts/settings/appSettings';
import browser from '../scripts/browser';
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
import * as htmlMediaHelper from '../components/htmlMediaHelper';
import * as webSettings from '../scripts/settings/webSettings';
import globalize from '../scripts/globalize';

View File

@ -8,7 +8,7 @@ import datetime from '../../scripts/datetime';
import globalize from '../../scripts/globalize';
import loading from '../loading/loading';
import skinManager from '../../scripts/themeManager';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import '../../elements/emby-select/emby-select';
import '../../elements/emby-checkbox/emby-checkbox';
import '../../elements/emby-button/emby-button';

View File

@ -1,7 +1,7 @@
import dom from '../../scripts/dom';
import dialogHelper from '../dialogHelper/dialogHelper';
import globalize from '../../scripts/globalize';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import '../../elements/emby-checkbox/emby-checkbox';
import '../../elements/emby-collapse/emby-collapse';
import './style.scss';

View File

@ -2,7 +2,7 @@ import escapeHtml from 'escape-html';
import inputManager from '../../scripts/inputManager';
import browser from '../../scripts/browser';
import globalize from '../../scripts/globalize';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import scrollHelper from '../../scripts/scrollHelper';
import serverNotifications from '../../scripts/serverNotifications';
import loading from '../loading/loading';

View File

@ -4,7 +4,7 @@ import layoutManager from '../layoutManager';
import focusManager from '../focusManager';
import globalize from '../../scripts/globalize';
import loading from '../loading/loading';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import homeSections from '../homesections/homesections';
import dom from '../../scripts/dom';
import '../listview/listview.scss';

View File

@ -3,7 +3,7 @@
import appSettings from '../scripts/settings/appSettings' ;
import browser from '../scripts/browser';
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
export function getSavedVolume() {
return appSettings.get('volume') || 1;

View File

@ -1,6 +1,6 @@
import { playbackManager } from './playback/playbackmanager';
import serverNotifications from '../scripts/serverNotifications';
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
function onUserDataChanged() {
const instance = this;

View File

@ -2,7 +2,7 @@
import { appHost } from './apphost';
import browser from '../scripts/browser';
import appSettings from '../scripts/settings/appSettings';
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
function setLayout(instance, layout, selectedLayout) {
if (layout === selectedLayout) {

View File

@ -1,6 +1,6 @@
import dom from '../scripts/dom';
import browser from '../scripts/browser';
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
import '../elements/emby-tabs/emby-tabs';
import '../elements/emby-button/emby-button';

View File

@ -1,6 +1,6 @@
import serverNotifications from '../../scripts/serverNotifications';
import { playbackManager } from '../playback/playbackmanager';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import globalize from '../../scripts/globalize';
import NotificationIcon from './notificationicon.png';

View File

@ -1,5 +1,5 @@
import datetime from '../../scripts/datetime';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import browser from '../../scripts/browser';
import imageLoader from '../images/imageLoader';
import layoutManager from '../layoutManager';

View File

@ -1,7 +1,8 @@
import { Events } from 'jellyfin-apiclient';
import { playbackManager } from './playbackmanager';
import dom from '../../scripts/dom';
import browser from '../../scripts/browser';
import Events from '../../utils/events.ts';
import './iconosd.scss';
import 'material-design-icons-iconfont';

View File

@ -1,6 +1,6 @@
import { playbackManager } from '../playback/playbackmanager';
import nowPlayingHelper from '../playback/nowplayinghelper';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import ServerConnections from '../ServerConnections';
import shell from '../../scripts/shell';

View File

@ -1,4 +1,4 @@
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import datetime from '../../scripts/datetime';
import appSettings from '../../scripts/settings/appSettings';
import itemHelper from '../itemHelper';

View File

@ -1,7 +1,7 @@
import { playbackManager } from './playbackmanager';
import layoutManager from '../layoutManager';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
let orientationLocked;

View File

@ -1,5 +1,5 @@
import appSettings from '../../scripts/settings/appSettings';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import browser from '../../scripts/browser';
import loading from '../loading/loading';
import { playbackManager } from '../playback/playbackmanager';

View File

@ -1,5 +1,5 @@
import { Events } from 'jellyfin-apiclient';
import { playbackManager } from '../playback/playbackmanager';
import Events from '../../utils/events.ts';
function transferPlayback(oldPlayer, newPlayer) {
const state = playbackManager.getPlayerState(oldPlayer);

View File

@ -1,8 +1,9 @@
import { Events } from 'jellyfin-apiclient';
import { playbackManager } from './playbackmanager';
import dom from '../../scripts/dom';
import browser from '../../scripts/browser';
import Events from '../../utils/events.ts';
import './iconosd.scss';
import 'material-design-icons-iconfont';

View File

@ -5,7 +5,7 @@ import focusManager from '../focusManager';
import qualityoptions from '../qualityOptions';
import globalize from '../../scripts/globalize';
import loading from '../loading/loading';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import '../../elements/emby-select/emby-select';
import '../../elements/emby-checkbox/emby-checkbox';
import ServerConnections from '../ServerConnections';

View File

@ -1,6 +1,6 @@
import { Events } from 'jellyfin-apiclient';
import '../../elements/emby-button/paper-icon-button-light';
import globalize from '../../scripts/globalize';
import Events from '../../utils/events.ts';
import layoutManager from '../layoutManager';
import { playbackManager } from '../playback/playbackmanager';
import playMethodHelper from '../playback/playmethodhelper';

View File

@ -1,4 +1,4 @@
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
import globalize from '../scripts/globalize';
import loading from './loading/loading';
import appSettings from '../scripts/settings/appSettings';

View File

@ -7,7 +7,7 @@ import scrollHelper from '../../scripts/scrollHelper';
import datetime from '../../scripts/datetime';
import imageLoader from '../images/imageLoader';
import recordingFields from './recordingfields';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import '../../elements/emby-button/emby-button';
import '../../elements/emby-button/paper-icon-button-light';
import '../../elements/emby-checkbox/emby-checkbox';

View File

@ -1,5 +1,5 @@
import globalize from '../../scripts/globalize';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import serverNotifications from '../../scripts/serverNotifications';
import loading from '../loading/loading';
import dom from '../../scripts/dom';

View File

@ -5,7 +5,7 @@ import listView from '../listview/listview';
import imageLoader from '../images/imageLoader';
import { playbackManager } from '../playback/playbackmanager';
import nowPlayingHelper from '../playback/nowplayinghelper';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import { appHost } from '../apphost';
import globalize from '../../scripts/globalize';
import layoutManager from '../layoutManager';

View File

@ -1,6 +1,6 @@
import type { BaseItemDto } from '@jellyfin/sdk/lib/generated-client';
import type { ApiClient } from 'jellyfin-apiclient';
import classNames from 'classnames';
import { ApiClient } from 'jellyfin-apiclient';
import React, { FunctionComponent, useEffect, useState } from 'react';
import globalize from '../../scripts/globalize';

View File

@ -1,6 +1,6 @@
import type { BaseItemDto } from '@jellyfin/sdk/lib/generated-client';
import type { ApiClient } from 'jellyfin-apiclient';
import classNames from 'classnames';
import { ApiClient } from 'jellyfin-apiclient';
import React, { FunctionComponent, useEffect, useState } from 'react';
import globalize from '../../scripts/globalize';

View File

@ -7,7 +7,7 @@ import loading from '../loading/loading';
import subtitleAppearanceHelper from './subtitleappearancehelper';
import settingsHelper from '../settingshelper';
import dom from '../../scripts/dom';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import '../listview/listview.scss';
import '../../elements/emby-select/emby-select';
import '../../elements/emby-slider/emby-slider';

View File

@ -1,6 +1,6 @@
import { playbackManager } from './playback/playbackmanager';
import * as userSettings from '../scripts/settings/userSettings';
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
import ServerConnections from './ServerConnections';
let currentOwnerId;

View File

@ -9,7 +9,7 @@ import '../../elements/emby-select/emby-select';
import '../../elements/emby-button/emby-button';
import '../../assets/css/flexstyles.scss';
import Dashboard from '../../utils/dashboard';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
export default function (page, providerId, options) {
function reload() {

View File

@ -6,7 +6,7 @@ import '../../elements/emby-input/emby-input';
import '../listview/listview.scss';
import '../../elements/emby-button/paper-icon-button-light';
import Dashboard from '../../utils/dashboard';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
export default function (page, providerId, options) {
function getListingProvider(config, id) {

View File

@ -1,6 +1,6 @@
import dom from '../../scripts/dom';
import { playbackManager } from '../playback/playbackmanager';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import mediaInfo from '../mediainfo/mediainfo';
import layoutManager from '../layoutManager';
import focusManager from '../focusManager';

View File

@ -1,6 +1,6 @@
import escapeHtml from 'escape-html';
import datetime from '../../scripts/datetime';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import itemHelper from '../../components/itemHelper';
import serverNotifications from '../../scripts/serverNotifications';
import dom from '../../scripts/dom';

View File

@ -1,10 +1,11 @@
import 'jquery';
import loading from '../../../components/loading/loading';
import { Events } from 'jellyfin-apiclient';
import globalize from '../../../scripts/globalize';
import serverNotifications from '../../../scripts/serverNotifications';
import { formatDistance, formatDistanceToNow } from 'date-fns';
import { getLocale, getLocaleWithSuffix } from '../../../scripts/dfnshelper';
import Events from '../../../utils/events.ts';
import '../../../components/listview/listview.scss';
import '../../../elements/emby-button/emby-button';

View File

@ -7,7 +7,7 @@ import { appHost } from '../../components/apphost';
import loading from '../../components/loading/loading';
import { appRouter } from '../../components/appRouter';
import layoutManager from '../../components/layoutManager';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import * as userSettings from '../../scripts/settings/userSettings';
import cardBuilder from '../../components/cardbuilder/cardBuilder';
import datetime from '../../scripts/datetime';

View File

@ -2,8 +2,9 @@ import cardBuilder from '../../components/cardbuilder/cardBuilder';
import imageLoader from '../../components/images/imageLoader';
import libraryBrowser from '../../scripts/libraryBrowser';
import loading from '../../components/loading/loading';
import { Events } from 'jellyfin-apiclient';
import * as userSettings from '../../scripts/settings/userSettings';
import Events from '../../utils/events.ts';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
export default function (view, params, tabContent) {

View File

@ -1,8 +1,8 @@
import { Events } from 'jellyfin-apiclient';
import loading from '../components/loading/loading';
import globalize from '../scripts/globalize';
import Dashboard, { pageIdOn } from '../utils/dashboard';
import { getParameterByName } from '../utils/url.ts';
import Events from '../utils/events.ts';
function onListingsSubmitted() {
Dashboard.navigate('livetvstatus.html');

View File

@ -1,12 +1,13 @@
import loading from '../../components/loading/loading';
import * as userSettings from '../../scripts/settings/userSettings';
import { Events } from 'jellyfin-apiclient';
import libraryBrowser from '../../scripts/libraryBrowser';
import { AlphaPicker } from '../../components/alphaPicker/alphaPicker';
import listView from '../../components/listview/listview';
import cardBuilder from '../../components/cardbuilder/cardBuilder';
import globalize from '../../scripts/globalize';
import Events from '../../utils/events.ts';
import { playbackManager } from '../../components/playback/playbackmanager';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
/* eslint-disable indent */

View File

@ -1,5 +1,4 @@
import escapeHtml from 'escape-html';
import { Events } from 'jellyfin-apiclient';
import layoutManager from '../../components/layoutManager';
import inputManager from '../../scripts/inputManager';
import * as userSettings from '../../scripts/settings/userSettings';
@ -10,11 +9,13 @@ import dom from '../../scripts/dom';
import imageLoader from '../../components/images/imageLoader';
import { playbackManager } from '../../components/playback/playbackmanager';
import globalize from '../../scripts/globalize';
import Dashboard from '../../utils/dashboard';
import Events from '../../utils/events.ts';
import '../../elements/emby-scroller/emby-scroller';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import '../../elements/emby-tabs/emby-tabs';
import '../../elements/emby-button/emby-button';
import Dashboard from '../../utils/dashboard';
/* eslint-disable indent */

View File

@ -1,5 +1,4 @@
import loading from '../../components/loading/loading';
import { Events } from 'jellyfin-apiclient';
import libraryBrowser from '../../scripts/libraryBrowser';
import imageLoader from '../../components/images/imageLoader';
import { AlphaPicker } from '../../components/alphaPicker/alphaPicker';
@ -7,6 +6,8 @@ import listView from '../../components/listview/listview';
import cardBuilder from '../../components/cardbuilder/cardBuilder';
import * as userSettings from '../../scripts/settings/userSettings';
import globalize from '../../scripts/globalize';
import Events from '../../utils/events.ts';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
/* eslint-disable indent */

View File

@ -1,6 +1,5 @@
import { playbackManager } from '../../components/playback/playbackmanager';
import loading from '../../components/loading/loading';
import { Events } from 'jellyfin-apiclient';
import libraryBrowser from '../../scripts/libraryBrowser';
import imageLoader from '../../components/images/imageLoader';
import AlphaPicker from '../../components/alphaPicker/alphaPicker';
@ -8,6 +7,8 @@ import listView from '../../components/listview/listview';
import cardBuilder from '../../components/cardbuilder/cardBuilder';
import * as userSettings from '../../scripts/settings/userSettings';
import globalize from '../../scripts/globalize';
import Events from '../../utils/events.ts';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
/* eslint-disable indent */

View File

@ -1,11 +1,12 @@
import loading from '../../components/loading/loading';
import { Events } from 'jellyfin-apiclient';
import libraryBrowser from '../../scripts/libraryBrowser';
import imageLoader from '../../components/images/imageLoader';
import { AlphaPicker } from '../../components/alphaPicker/alphaPicker';
import listView from '../../components/listview/listview';
import cardBuilder from '../../components/cardbuilder/cardBuilder';
import * as userSettings from '../../scripts/settings/userSettings';
import Events from '../../utils/events.ts';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
/* eslint-disable indent */

View File

@ -1,14 +1,15 @@
import { Events } from 'jellyfin-apiclient';
import libraryBrowser from '../../scripts/libraryBrowser';
import imageLoader from '../../components/images/imageLoader';
import listView from '../../components/listview/listview';
import loading from '../../components/loading/loading';
import { playbackManager } from '../../components/playback/playbackmanager';
import * as userSettings from '../../scripts/settings/userSettings';
import globalize from '../../scripts/globalize';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import Dashboard from '../../utils/dashboard';
import {playbackManager} from '../../components/playback/playbackmanager';
import Events from '../../utils/events.ts';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
export default function (view, params, tabContent) {
function getPageData(context) {

View File

@ -9,7 +9,7 @@ import datetime from '../../../scripts/datetime';
import itemHelper from '../../../components/itemHelper';
import mediaInfo from '../../../components/mediainfo/mediainfo';
import focusManager from '../../../components/focusManager';
import { Events } from 'jellyfin-apiclient';
import Events from '../../../utils/events.ts';
import globalize from '../../../scripts/globalize';
import { appHost } from '../../../components/apphost';
import layoutManager from '../../../components/layoutManager';

View File

@ -1,13 +1,14 @@
import loading from '../../components/loading/loading';
import { Events } from 'jellyfin-apiclient';
import libraryBrowser from '../../scripts/libraryBrowser';
import imageLoader from '../../components/images/imageLoader';
import listView from '../../components/listview/listview';
import cardBuilder from '../../components/cardbuilder/cardBuilder';
import * as userSettings from '../../scripts/settings/userSettings';
import globalize from '../../scripts/globalize';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import Dashboard from '../../utils/dashboard';
import Events from '../../utils/events.ts';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
/* eslint-disable indent */

View File

@ -1,5 +1,4 @@
import { Events } from 'jellyfin-apiclient';
import inputManager from '../../scripts/inputManager';
import libraryMenu from '../../scripts/libraryMenu';
import layoutManager from '../../components/layoutManager';
@ -14,6 +13,7 @@ import '../../assets/css/scrollstyles.scss';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import '../../elements/emby-button/emby-button';
import Dashboard from '../../utils/dashboard';
import Events from '../../utils/events.ts';
import autoFocuser from '../../components/autoFocuser';
/* eslint-disable indent */

View File

@ -1,5 +1,4 @@
import loading from '../../components/loading/loading';
import { Events } from 'jellyfin-apiclient';
import libraryBrowser from '../../scripts/libraryBrowser';
import imageLoader from '../../components/images/imageLoader';
import listView from '../../components/listview/listview';
@ -7,6 +6,8 @@ import cardBuilder from '../../components/cardbuilder/cardBuilder';
import AlphaPicker from '../../components/alphaPicker/alphaPicker';
import * as userSettings from '../../scripts/settings/userSettings';
import globalize from '../../scripts/globalize';
import Events from '../../utils/events.ts';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
/* eslint-disable indent */

View File

@ -1,7 +1,7 @@
import { Events } from 'jellyfin-apiclient';
import toast from '../../../components/toast/toast';
import globalize from '../../../scripts/globalize';
import appSettings from '../../../scripts/settings/appSettings';
import Events from '../../../utils/events.ts';
export default function (view) {
function submit(e) {

View File

@ -1,7 +1,8 @@
import EmbyProgressRing from '../emby-progressring/emby-progressring';
import dom from '../../scripts/dom';
import serverNotifications from '../../scripts/serverNotifications';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import 'webcomponents.js/webcomponents-lite';
/* eslint-disable indent */

View File

@ -8,7 +8,7 @@ import dom from '../../scripts/dom';
import loading from '../../components/loading/loading';
import focusManager from '../../components/focusManager';
import serverNotifications from '../../scripts/serverNotifications';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import 'webcomponents.js/webcomponents-lite';
import ServerConnections from '../../components/ServerConnections';
import Sortable from 'sortablejs';

View File

@ -1,6 +1,6 @@
import serverNotifications from '../../scripts/serverNotifications';
import { Events } from 'jellyfin-apiclient';
import globalize from '../../scripts/globalize';
import Events from '../../utils/events.ts';
import EmbyButtonPrototype from '../../elements/emby-button/emby-button';
import ServerConnections from '../../components/ServerConnections';

View File

@ -1,6 +1,6 @@
import serverNotifications from '../../scripts/serverNotifications';
import { Events } from 'jellyfin-apiclient';
import globalize from '../../scripts/globalize';
import Events from '../../utils/events.ts';
import EmbyButtonPrototype from '../emby-button/emby-button';
import ServerConnections from '../../components/ServerConnections';

View File

@ -9,7 +9,7 @@ import 'resize-observer-polyfill';
import './assets/css/site.scss';
import React from 'react';
import * as ReactDOM from 'react-dom';
import { Events } from 'jellyfin-apiclient';
import Events from './utils/events.ts';
import ServerConnections from './components/ServerConnections';
import globalize from './scripts/globalize';
import browser from './scripts/browser';

View File

@ -1,4 +1,3 @@
import { Events } from 'jellyfin-apiclient';
import 'material-design-icons-iconfont';
import loading from '../../components/loading/loading';
@ -10,6 +9,7 @@ import TableOfContents from './tableOfContents';
import dom from '../../scripts/dom';
import { translateHtml } from '../../scripts/globalize';
import * as userSettings from '../../scripts/settings/userSettings';
import Events from '../../utils/events.ts';
import '../../elements/emby-button/paper-icon-button-light';

View File

@ -2,10 +2,10 @@ import appSettings from '../../scripts/settings/appSettings';
import * as userSettings from '../../scripts/settings/userSettings';
import { playbackManager } from '../../components/playback/playbackmanager';
import globalize from '../../scripts/globalize';
import { Events } from 'jellyfin-apiclient';
import castSenderApiLoader from '../../components/castSenderApi';
import ServerConnections from '../../components/ServerConnections';
import alert from '../../components/alert';
import Events from '../../utils/events.ts';
// Based on https://github.com/googlecast/CastVideos-chrome/blob/master/CastVideos.js

View File

@ -1,9 +1,9 @@
import { Events } from 'jellyfin-apiclient';
import browser from '../../scripts/browser';
import { appHost } from '../../components/apphost';
import * as htmlMediaHelper from '../../components/htmlMediaHelper';
import profileBuilder from '../../scripts/browserDeviceProfile';
import { getIncludeCorsCredentials } from '../../scripts/settings/webSettings';
import Events from '../../utils/events.ts';
function getDefaultProfile() {
return profileBuilder({});

View File

@ -1,5 +1,4 @@
import browser from '../../scripts/browser';
import { Events } from 'jellyfin-apiclient';
import { appHost } from '../../components/apphost';
import loading from '../../components/loading/loading';
import dom from '../../scripts/dom';
@ -31,6 +30,7 @@ import ServerConnections from '../../components/ServerConnections';
import profileBuilder from '../../scripts/browserDeviceProfile';
import { getIncludeCorsCredentials } from '../../scripts/settings/webSettings';
import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../components/backdrop/backdrop';
import Events from '../../utils/events.ts';
/**
* Returns resolved URL.

View File

@ -4,9 +4,10 @@ import keyboardnavigation from '../../scripts/keyboardNavigation';
import dialogHelper from '../../components/dialogHelper/dialogHelper';
import dom from '../../scripts/dom';
import { appRouter } from '../../components/appRouter';
import Events from '../../utils/events.ts';
import './style.scss';
import '../../elements/emby-button/paper-icon-button-light';
import { Events } from 'jellyfin-apiclient';
export class PdfPlayer {
constructor() {

View File

@ -1,7 +1,7 @@
import { playbackManager } from '../../components/playback/playbackmanager';
import { Events } from 'jellyfin-apiclient';
import serverNotifications from '../../scripts/serverNotifications';
import ServerConnections from '../../components/ServerConnections';
import Events from '../../utils/events.ts';
function getActivePlayerId() {
const info = playbackManager.getPlayerInfo();

View File

@ -3,7 +3,7 @@
* @module components/syncPlay/core/Helper
*/
import { Events } from 'jellyfin-apiclient';
import Events from '../../../utils/events.ts';
/**
* Constants

View File

@ -3,7 +3,6 @@
* @module components/syncPlay/core/Manager
*/
import { Events } from 'jellyfin-apiclient';
import * as Helper from './Helper';
import TimeSyncCore from './timeSync/TimeSyncCore';
import PlaybackCore from './PlaybackCore';
@ -11,6 +10,7 @@ import QueueCore from './QueueCore';
import Controller from './Controller';
import toast from '../../../components/toast/toast';
import globalize from '../../../scripts/globalize';
import Events from '../../../utils/events.ts';
/**
* Class that manages the SyncPlay feature.

View File

@ -2,9 +2,9 @@
* Module that manages the playback of SyncPlay.
* @module components/syncPlay/core/PlaybackCore
*/
import { Events } from 'jellyfin-apiclient';
import browser from '../../../scripts/browser';
import Events from '../../../utils/events.ts';
import { toBoolean, toFloat } from '../../../utils/string.ts';
import * as Helper from './Helper';
import { getSetting } from './Settings';

View File

@ -3,7 +3,7 @@
* @module components/syncPlay/core/players/GenericPlayer
*/
import { Events } from 'jellyfin-apiclient';
import Events from '../../../../utils/events.ts';
/**
* Class that translates events from a player to SyncPlay events.

View File

@ -3,7 +3,7 @@
* @module components/syncPlay/core/timeSync/TimeSync
*/
import { Events } from 'jellyfin-apiclient';
import Events from '../../../../utils/events.ts';
/**
* Time estimation.

View File

@ -3,8 +3,8 @@
* @module components/syncPlay/core/timeSync/TimeSyncCore
*/
import { Events } from 'jellyfin-apiclient';
import appSettings from '../../../../scripts/settings/appSettings';
import Events from '../../../../utils/events.ts';
import { toFloat } from '../../../../utils/string.ts';
import { getSetting } from '../Settings';
import TimeSyncServer from './TimeSyncServer';

View File

@ -1,7 +1,6 @@
import { Events } from 'jellyfin-apiclient';
import { playbackManager } from '../../components/playback/playbackmanager';
import ServerConnections from '../../components/ServerConnections';
import Events from '../../utils/events';
import SyncPlay from './core';
import SyncPlayNoActivePlayer from './ui/players/NoActivePlayer';
import SyncPlayHtmlVideoPlayer from './ui/players/HtmlVideoPlayer';

View File

@ -1,4 +1,3 @@
import { Events } from 'jellyfin-apiclient';
import SyncPlay from '../core';
import SyncPlaySettingsEditor from './settings/SettingsEditor';
import loading from '../../../components/loading/loading';
@ -7,6 +6,8 @@ import actionsheet from '../../../components/actionSheet/actionSheet';
import globalize from '../../../scripts/globalize';
import playbackPermissionManager from './playbackPermissionManager';
import ServerConnections from '../../../components/ServerConnections';
import Events from '../../../utils/events.ts';
import './groupSelectionMenu.scss';
/**

View File

@ -3,8 +3,8 @@
* @module components/syncPlay/ui/players/HtmlVideoPlayer
*/
import { Events } from 'jellyfin-apiclient';
import NoActivePlayer from './NoActivePlayer';
import Events from '../../../../utils/events.ts';
/**
* Class that manages the HtmlVideoPlayer for SyncPlay.

View File

@ -3,7 +3,6 @@
* @module components/syncPlay/settings/SettingsEditor
*/
import { Events } from 'jellyfin-apiclient';
import SyncPlay from '../../core';
import { setSetting } from '../../core/Settings';
import dialogHelper from '../../../../components/dialogHelper/dialogHelper';
@ -11,6 +10,7 @@ import layoutManager from '../../../../components/layoutManager';
import loading from '../../../../components/loading/loading';
import toast from '../../../../components/toast/toast';
import globalize from '../../../../scripts/globalize';
import Events from '../../../../utils/events.ts';
import 'material-design-icons-iconfont';
import '../../../../elements/emby-input/emby-input';

View File

@ -1,8 +1,8 @@
import { Events } from 'jellyfin-apiclient';
import browser from '../../scripts/browser';
import { appRouter } from '../../components/appRouter';
import loading from '../../components/loading/loading';
import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../components/backdrop/backdrop';
import Events from '../../utils/events.ts';
/* globals YT */

View File

@ -1,8 +1,8 @@
import * as userSettings from './settings/userSettings';
import skinManager from './themeManager';
import { Events } from 'jellyfin-apiclient';
import ServerConnections from '../components/ServerConnections';
import { pageClassOn } from '../utils/dashboard';
import Events from '../utils/events.ts';
// Set the default theme when loading
skinManager.setTheme(userSettings.theme())

View File

@ -1,6 +1,6 @@
import { Events } from 'jellyfin-apiclient';
import { playbackManager } from '../components/playback/playbackmanager';
import ServerConnections from '../components/ServerConnections';
import Events from '../utils/events.ts';
export function supported() {
return typeof(Storage) !== 'undefined';

View File

@ -1,7 +1,7 @@
import { Events } from 'jellyfin-apiclient';
import isEmpty from 'lodash-es/isEmpty';
import { currentSettings as userSettings } from './settings/userSettings';
import Events from '../utils/events.ts';
/* eslint-disable indent */

View File

@ -4,7 +4,6 @@ import Headroom from 'headroom.js';
import dom from './dom';
import layoutManager from '../components/layoutManager';
import inputManager from './inputManager';
import { Events } from 'jellyfin-apiclient';
import viewManager from '../components/viewManager/viewManager';
import { appRouter } from '../components/appRouter';
import { appHost } from '../components/apphost';
@ -17,6 +16,7 @@ import imageHelper from './imagehelper';
import { getMenuLinks } from '../scripts/settings/webSettings';
import Dashboard, { pageClassOn } from '../utils/dashboard';
import ServerConnections from '../components/ServerConnections';
import Events from '../utils/events.ts';
import { getParameterByName } from '../utils/url.ts';
import '../elements/emby-button/paper-icon-button-light';

View File

@ -1,9 +1,9 @@
import inputManager from './inputManager';
import focusManager from '../components/focusManager';
import browser from '../scripts/browser';
import browser from './browser';
import layoutManager from '../components/layoutManager';
import { Events } from 'jellyfin-apiclient';
import dom from '../scripts/dom';
import dom from './dom';
import Events from '../utils/events.ts';
/* eslint-disable indent */
const self = {};

View File

@ -1,9 +1,10 @@
import { Events } from 'jellyfin-apiclient';
import { playbackManager } from '../components/playback/playbackmanager';
import { pluginManager } from '../components/pluginManager';
import inputManager from './inputManager';
import * as userSettings from './settings/userSettings';
import ServerConnections from '../components/ServerConnections';
import Events from '../utils/events.ts';
import './screensavermanager.scss';
function getMinIdleTime() {

View File

@ -1,12 +1,12 @@
import { playbackManager } from '../components/playback/playbackmanager';
import SyncPlay from '../plugins/syncPlay/core';
import { Events } from 'jellyfin-apiclient';
import inputManager from '../scripts/inputManager';
import focusManager from '../components/focusManager';
import { appRouter } from '../components/appRouter';
import ServerConnections from '../components/ServerConnections';
import toast from '../components/toast/toast';
import alert from '../components/alert';
import Events from '../utils/events.ts';
const serverNotifications = {};

View File

@ -1,4 +1,5 @@
import { AppStorage, Events } from 'jellyfin-apiclient';
import { AppStorage } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import { toBoolean } from '../../utils/string.ts';
class AppSettings {

View File

@ -1,5 +1,5 @@
import appSettings from './appSettings';
import { Events } from 'jellyfin-apiclient';
import Events from '../../utils/events.ts';
import { toBoolean } from '../../utils/string.ts';
function onSaveTimeout() {

View File

@ -1,9 +1,10 @@
import { Events } from 'jellyfin-apiclient';
import serverNotifications from '../scripts/serverNotifications';
import globalize from '../scripts/globalize';
import '../elements/emby-button/emby-button';
import ServerConnections from '../components/ServerConnections';
import Events from '../utils/events.ts';
import '../elements/emby-button/emby-button';
function taskbutton(options) {
function pollTasks() {

View File

@ -1,5 +1,5 @@
import dom from '../scripts/dom';
import { Events } from 'jellyfin-apiclient';
import Events from '../utils/events.ts';
function getTouches(e) {
return e.changedTouches || e.targetTouches || e.touches;

50
src/utils/events.ts Normal file
View File

@ -0,0 +1,50 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
interface Event {
type: string;
}
type callback = (e: Event, ...args: any[]) => void;
function getCallbacks(obj: any, type: string): callback[] {
if (!obj) {
throw new Error('obj cannot be null!');
}
obj._callbacks = obj._callbacks || {};
let callbacks = obj._callbacks[type];
if (!callbacks) {
obj._callbacks[type] = [];
callbacks = obj._callbacks[type];
}
return callbacks;
}
export default {
on(obj: any, type: string, fn: callback): void {
const callbacks = getCallbacks(obj, type);
callbacks.push(fn);
},
off(obj: any, type: string, fn: callback): void {
const callbacks = getCallbacks(obj, type);
const i = callbacks.indexOf(fn);
if (i !== -1) {
callbacks.splice(i, 1);
}
},
trigger(obj: any, type: string, args: any[] = []) {
const eventArgs: [Event, ...any] = [{ type }, ...args];
getCallbacks(obj, type).slice(0)
.forEach(callback => {
callback.apply(obj, eventArgs);
});
}
};
/* eslint-enable @typescript-eslint/no-explicit-any */