Merge pull request #1716 from MrTimscampi/pluginmanager-es6

Migrate PluginManager and PackageManager to ES6
This commit is contained in:
Joshua M. Boniface 2020-08-16 12:17:22 -04:00 committed by GitHub
commit e4a922ad60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 256 additions and 240 deletions

View file

@ -302,7 +302,7 @@ import 'material-icons';
$(document).on('itemsaved', '.metadataEditorPage', function (e, item) {
updateEditorNode(this, item);
}).on('pagebeforeshow', '.metadataEditorPage', function () {
/* eslint-disable-next-line no-unused-expressions */
/* eslint-disable-next-line @babel/no-unused-expressions */
import('css!assets/css/metadataeditor.css');
}).on('pagebeforeshow', '.metadataEditorPage', function () {
var page = this;

View file

@ -155,7 +155,7 @@ export function enable() {
function attachGamepadScript(e) {
console.log('Gamepad connected! Attaching gamepadtokey.js script');
window.removeEventListener('gamepadconnected', attachGamepadScript);
/* eslint-disable-next-line no-unused-expressions */
/* eslint-disable-next-line @babel/no-unused-expressions */
import('scripts/gamepadtokey');
}

View file

@ -479,7 +479,7 @@ function initClient() {
}
function loadPlugins(appHost, browser, shell) {
console.debug('loading installed plugins');
console.groupCollapsed('loading installed plugins');
return new Promise(function (resolve, reject) {
require(['webSettings'], function (webSettings) {
webSettings.getPlugins().then(function (list) {
@ -497,11 +497,18 @@ function initClient() {
list = list.concat(window.NativeShell.getPlugins());
}
Promise.all(list.map(loadPlugin)).then(function () {
require(['packageManager'], function (packageManager) {
packageManager.init().then(resolve, reject);
});
}, reject);
Promise.all(list.map(loadPlugin))
.then(function () {
console.debug('finished loading plugins');
})
.catch(() => reject)
.finally(() => {
console.groupEnd('loading installed plugins');
require(['packageManager'], function (packageManager) {
packageManager.default.init().then(resolve, reject);
});
})
;
});
});
});
@ -510,7 +517,7 @@ function initClient() {
function loadPlugin(url) {
return new Promise(function (resolve, reject) {
require(['pluginManager'], function (pluginManager) {
pluginManager.loadPlugin(url).then(resolve, reject);
pluginManager.default.loadPlugin(url).then(resolve, reject);
});
});
}