From cf1ca53f9c8ed65ab8f492ad2ba3fdf257bcf938 Mon Sep 17 00:00:00 2001 From: grafixeyehero Date: Thu, 11 Jun 2020 22:07:24 +0300 Subject: [PATCH] replace require with Dynamic Imports --- src/components/imageOptionsEditor/imageOptionsEditor.js | 3 +-- .../libraryoptionseditor/libraryoptionseditor.js | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/imageOptionsEditor/imageOptionsEditor.js b/src/components/imageOptionsEditor/imageOptionsEditor.js index 5e4f88f158..a1e7f71a9c 100644 --- a/src/components/imageOptionsEditor/imageOptionsEditor.js +++ b/src/components/imageOptionsEditor/imageOptionsEditor.js @@ -93,8 +93,7 @@ export class editor { constructor() { this.show = (itemType, options, availableOptions) => { return new Promise((resolve) => { - //TODO: remove require - require(['text!./components/imageOptionsEditor/imageOptionsEditor.template.html'], template => { + import('text!./components/imageOptionsEditor/imageOptionsEditor.template.html').then(({default: template}) => { const dlg = dialogHelper.createDialog({ size: 'small', removeOnClose: true, diff --git a/src/components/libraryoptionseditor/libraryoptionseditor.js b/src/components/libraryoptionseditor/libraryoptionseditor.js index f9a9d43276..6a5f4f6e9b 100644 --- a/src/components/libraryoptionseditor/libraryoptionseditor.js +++ b/src/components/libraryoptionseditor/libraryoptionseditor.js @@ -268,8 +268,8 @@ import 'emby-input'; return true; } - function populateMetadataSettings(parent, contentType, isNewLibrary) { - isNewLibrary = parent.classList.contains('newlibrary'); + function populateMetadataSettings(parent, contentType) { + const isNewLibrary = parent.classList.contains('newlibrary'); return ApiClient.getJSON(ApiClient.getUrl('Libraries/AvailableOptions', { LibraryContentType: contentType, IsNewLibrary: isNewLibrary @@ -365,8 +365,7 @@ import 'emby-input'; const isNewLibrary = null === libraryOptions; isNewLibrary && parent.classList.add('newlibrary'); return new Promise((resolve) => { - //TODO: remove require - require(['text!./components/libraryoptionseditor/libraryoptionseditor.template.html'], function (template) { + import('text!./libraryoptionseditor.template.html').then(({default: template}) => { parent.innerHTML = globalize.translateDocument(template); populateRefreshInterval(parent.querySelector('#selectAutoRefreshInterval')); const promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];