Migrated to es6 module

This commit is contained in:
matjaz321 2020-08-01 14:52:15 +02:00
parent a609e3e2b4
commit 39a1d94c50
2 changed files with 26 additions and 25 deletions

View file

@ -1,30 +1,30 @@
define(['events', 'loading', 'globalize'], function (events, loading, globalize) {
'use strict';
import events from 'events';
import loading from 'loading';
import globalize from 'globalize';
function onListingsSubmitted() {
Dashboard.navigate('livetvstatus.html');
}
function onListingsSubmitted() {
Dashboard.navigate('livetvstatus.html');
}
function init(page, type, providerId) {
var url = 'components/tvproviders/' + type + '.js';
function init(page, type, providerId) {
const url = 'components/tvproviders/' + type + '.js';
require([url], function (factory) {
var instance = new factory(page, providerId, {});
events.on(instance, 'submitted', onListingsSubmitted);
instance.init();
});
}
function loadTemplate(page, type, providerId) {
require(['text!./components/tvproviders/' + type + '.template.html'], function (html) {
page.querySelector('.providerTemplate').innerHTML = globalize.translateHtml(html);
init(page, type, providerId);
});
}
pageIdOn('pageshow', 'liveTvGuideProviderPage', function () {
loading.show();
var providerId = getParameterByName('id');
loadTemplate(this, getParameterByName('type'), providerId);
import(url).then(({default: factory}) => {
const instance = new factory(page, providerId, {});
events.on(instance, 'submitted', onListingsSubmitted);
instance.init();
});
}
function loadTemplate(page, type, providerId) {
import('text!./../components/tvproviders/' + type + '.template.html').then(({default: html}) => {
page.querySelector('.providerTemplate').innerHTML = globalize.translateHtml(html);
init(page, type, providerId);
});
}
pageIdOn('pageshow', 'liveTvGuideProviderPage', function () {
loading.show();
const providerId = getParameterByName('id');
loadTemplate(this, getParameterByName('type'), providerId);
});