replace require with Dynamic Imports

This commit is contained in:
grafixeyehero 2020-06-11 22:07:24 +03:00
parent eff468dc82
commit cf1ca53f9c
2 changed files with 4 additions and 6 deletions

View File

@ -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,

View File

@ -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'))];