Support async plugin loading from window

This commit is contained in:
Niels van Velzen 2020-11-29 14:36:25 +01:00 committed by GitHub
parent 0a09062ad4
commit 00c6501dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,9 +74,14 @@ import { playbackManager } from './playback/playbackmanager';
if (typeof pluginSpec === 'string') {
if (pluginSpec in window) {
console.log(`Loading plugin (via window): ${pluginSpec}`);
let pluginInstance = await window[pluginSpec];
if (typeof pluginInstance === 'function') {
pluginInstance = await pluginInstance();
}
// init plugin and pass basic dependencies
plugin = new window[pluginSpec]({
plugin = new pluginInstance({
events: Events,
loading,
appSettings,