feat(plugins): Add moduleURLs in addition to scriptURLs
This commit is contained in:
parent
53cd12a16a
commit
f6b82baae3
@ -7,11 +7,11 @@ export class OHIFPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load an individual script URL
|
// load an individual script URL
|
||||||
static loadScript(scriptURL) {
|
static loadScript(scriptURL, type = "text/javascript") {
|
||||||
const script = document.createElement("script");
|
const script = document.createElement("script");
|
||||||
|
|
||||||
script.src = scriptURL;
|
script.src = scriptURL;
|
||||||
script.type = "text/javascript";
|
script.type = type;
|
||||||
script.async = false;
|
script.async = false;
|
||||||
|
|
||||||
const head = document.getElementsByTagName("head")[0];
|
const head = document.getElementsByTagName("head")[0];
|
||||||
@ -24,13 +24,19 @@ export class OHIFPlugin {
|
|||||||
// reload all the dependency scripts and also
|
// reload all the dependency scripts and also
|
||||||
// the main plugin script url.
|
// the main plugin script url.
|
||||||
static reloadPlugin(plugin) {
|
static reloadPlugin(plugin) {
|
||||||
console.warn(`reloadPlugin: ${plugin.name}`);
|
|
||||||
if (plugin.scriptURLs && plugin.scriptURLs.length) {
|
if (plugin.scriptURLs && plugin.scriptURLs.length) {
|
||||||
plugin.scriptURLs.forEach(scriptURL => {
|
plugin.scriptURLs.forEach(scriptURL => {
|
||||||
this.loadScript(scriptURL).onload = function() {}
|
this.loadScript(scriptURL).onload = function() {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Later we should probably merge script and module URLs
|
||||||
|
if (plugin.moduleURLs && plugin.moduleURLs.length) {
|
||||||
|
plugin.moduleURLs.forEach(moduleURLs => {
|
||||||
|
this.loadScript(moduleURLs, "module").onload = function() {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let scriptURL = plugin.url;
|
let scriptURL = plugin.url;
|
||||||
|
|
||||||
if (plugin.allowCaching === false) {
|
if (plugin.allowCaching === false) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user