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

Migration of tabbedview to ES6 module

This commit is contained in:
Cameron 2020-07-31 16:12:49 +01:00
parent 997054ab12
commit 39627f364a
2 changed files with 32 additions and 29 deletions

View file

@ -158,6 +158,7 @@
"src/components/syncPlay/playbackPermissionManager.js", "src/components/syncPlay/playbackPermissionManager.js",
"src/components/syncPlay/syncPlayManager.js", "src/components/syncPlay/syncPlayManager.js",
"src/components/syncPlay/timeSyncManager.js", "src/components/syncPlay/timeSyncManager.js",
"src/components/tabbedview/tabbedview.js",
"src/controllers/session/addServer/index.js", "src/controllers/session/addServer/index.js",
"src/controllers/session/forgotPassword/index.js", "src/controllers/session/forgotPassword/index.js",
"src/controllers/session/redeemPassword/index.js", "src/controllers/session/redeemPassword/index.js",

View file

@ -1,30 +1,33 @@
define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (backdrop, mainTabsManager, layoutManager) { import backdrop from 'backdrop';
'use strict'; import * as mainTabsManager from 'mainTabsManager';
import layoutManager from 'layoutManager';
import 'emby-tabs';
function onViewDestroy(e) { function onViewDestroy(e) {
var tabControllers = this.tabControllers; var tabControllers = this.tabControllers;
if (tabControllers) { if (tabControllers) {
tabControllers.forEach(function (t) { tabControllers.forEach(function (t) {
if (t.destroy) { if (t.destroy) {
t.destroy(); t.destroy();
} }
}); });
this.tabControllers = null; this.tabControllers = null;
}
this.view = null;
this.params = null;
this.currentTabController = null;
this.initialTabIndex = null;
} }
function onBeforeTabChange() { this.view = null;
this.params = null;
this.currentTabController = null;
this.initialTabIndex = null;
}
} function onBeforeTabChange() {
function TabbedView(view, params) { }
class TabbedView {
constructor(view, params) {
this.tabControllers = []; this.tabControllers = [];
this.view = view; this.view = view;
this.params = params; this.params = params;
@ -85,7 +88,7 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
view.addEventListener('viewdestroy', onViewDestroy.bind(this)); view.addEventListener('viewdestroy', onViewDestroy.bind(this));
} }
TabbedView.prototype.onResume = function (options) { onResume(options) {
this.setTitle(); this.setTitle();
backdrop.clearBackdrop(); backdrop.clearBackdrop();
@ -96,19 +99,18 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
} else if (currentTabController && currentTabController.onResume) { } else if (currentTabController && currentTabController.onResume) {
currentTabController.onResume({}); currentTabController.onResume({});
} }
}; }
TabbedView.prototype.onPause = function () { onPause() {
var currentTabController = this.currentTabController; var currentTabController = this.currentTabController;
if (currentTabController && currentTabController.onPause) { if (currentTabController && currentTabController.onPause) {
currentTabController.onPause(); currentTabController.onPause();
} }
}; }
setTitle() {
TabbedView.prototype.setTitle = function () {
Emby.Page.setTitle(''); Emby.Page.setTitle('');
}; }
}
return TabbedView; export default TabbedView;
});