tweak plugin initialization to enable multi-instance plugins
This commit is contained in:
parent
7e72b10fa5
commit
e58502b3fb
20 changed files with 128 additions and 110 deletions
|
@ -56,7 +56,7 @@ export default class Plugins {
|
|||
scriptsToLoad = scripts.length;
|
||||
|
||||
const scriptLoadedCallback = (s) => {
|
||||
if( typeof s.callback === 'function' ) s.callback();
|
||||
if( s && typeof s.callback === 'function' ) s.callback();
|
||||
|
||||
if( --scriptsToLoad === 0 ) {
|
||||
this.initPlugins().then( resolve );
|
||||
|
@ -69,9 +69,13 @@ export default class Plugins {
|
|||
this.registerPlugin( s );
|
||||
scriptLoadedCallback( s );
|
||||
}
|
||||
else {
|
||||
else if( typeof s.src === 'string' ) {
|
||||
loadScript( s.src, () => scriptLoadedCallback(s) );
|
||||
}
|
||||
else {
|
||||
console.warn( 'Unrecognized plugin format', s );
|
||||
scriptLoadedCallback();
|
||||
}
|
||||
} );
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue