Merge pull request #1724 from matjaz321/migration-of-livetvguideprovider-to-es6-module

Migrated `livetvguideprovider.js` to es6 module
This commit is contained in:
dkanada 2020-08-04 01:08:54 +09:00 committed by GitHub
commit 34b62119a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 27 deletions

View File

@ -211,6 +211,7 @@
"src/controllers/searchpage.js",
"src/controllers/livetvtuner.js",
"src/controllers/livetvstatus.js",
"src/controllers/livetvguideprovider.js",
"src/controllers/livetvsettings.js",
"src/controllers/shows/episodes.js",
"src/controllers/shows/tvgenres.js",

View File

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