Move unloading plugin main script to the plugin manager
This commit is contained in:
parent
4bed9f726c
commit
42a89129d4
|
@ -307,7 +307,7 @@ export default class {
|
|||
|
||||
const index = this.getContentIndex(content);
|
||||
|
||||
delete Globals.require.cache[Globals.require.resolve(content.paths.mainPath)];
|
||||
if (this.unloadContentHook) this.unloadContentHook(content);
|
||||
|
||||
if (reload) {
|
||||
const newcontent = await this.preloadContent(content.dirName, true, index);
|
||||
|
|
|
@ -279,11 +279,7 @@ export default class PluginApi {
|
|||
}
|
||||
addModal(_modal, component) {
|
||||
const modal = Modals.add(_modal, component);
|
||||
modal.on('close', () => {
|
||||
let index;
|
||||
while ((index = this.modalStack.findIndex(m => m === modal)) > -1)
|
||||
this.modalStack.splice(index, 1);
|
||||
});
|
||||
modal.on('close', () => Utils.removeFromArray(this.modalStack, modal));
|
||||
this.modalStack.push(modal);
|
||||
return modal;
|
||||
}
|
||||
|
|
|
@ -128,6 +128,10 @@ export default class extends ContentManager {
|
|||
static get unloadPlugin() { return this.unloadContent }
|
||||
static get reloadPlugin() { return this.reloadContent }
|
||||
|
||||
static unloadContentHook(content, reload) {
|
||||
delete Globals.require.cache[Globals.require.resolve(content.paths.mainPath)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops a plugin.
|
||||
* @param {Plugin|String} plugin
|
||||
|
|
Loading…
Reference in New Issue