|
|
@ -96,12 +96,14 @@ class PluginManagerComponent { |
|
|
|
let action = (event) => { |
|
|
|
let action = (event) => { |
|
|
|
if (this.activated.hasOwnProperty(item)) { |
|
|
|
if (this.activated.hasOwnProperty(item)) { |
|
|
|
this.deactivateInternal(item) |
|
|
|
this.deactivateInternal(item) |
|
|
|
|
|
|
|
event.target.innerHTML = 'activate' |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.activateInternal(item) |
|
|
|
this.activateInternal(item) |
|
|
|
|
|
|
|
event.target.innerHTML = 'deactivate' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctrBtns = yo`<div id='${item}'>
|
|
|
|
ctrBtns = yo`<div id='${item}Activation'>
|
|
|
|
<button onclick=${(event) => { action(event) }} >${this.activated[item] ? 'deactivate' : 'activate'}</button> |
|
|
|
<button onclick=${(event) => { action(event) }} >${this.activated[item] ? 'deactivate' : 'activate'}</button> |
|
|
|
</div>` |
|
|
|
</div>` |
|
|
|
|
|
|
|
|
|
|
@ -125,12 +127,13 @@ class PluginManagerComponent { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
deactivateInternal (name) { |
|
|
|
deactivateInternal (name) { |
|
|
|
|
|
|
|
if (!this.activated[name]) return |
|
|
|
|
|
|
|
this.event.emit('removingItem', this.activated[name]) |
|
|
|
delete this.activated[name] |
|
|
|
delete this.activated[name] |
|
|
|
this.event.emit('removingItem', name) |
|
|
|
|
|
|
|
if (this.view) this.view.querySelector(`#${name} button`).innerHTML = 'activate' |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
activateInternal (name) { |
|
|
|
activateInternal (name) { |
|
|
|
|
|
|
|
if (this.activated[name]) return |
|
|
|
const mod = this.modulesDefinition[name] |
|
|
|
const mod = this.modulesDefinition[name] |
|
|
|
let dep |
|
|
|
let dep |
|
|
|
if (mod.dep) dep = this.activateInternal(mod.dep) |
|
|
|
if (mod.dep) dep = this.activateInternal(mod.dep) |
|
|
@ -149,7 +152,6 @@ class PluginManagerComponent { |
|
|
|
this.data.proxy.register(mod, instance) |
|
|
|
this.data.proxy.register(mod, instance) |
|
|
|
} |
|
|
|
} |
|
|
|
this.activated[mod.name] = mod
|
|
|
|
this.activated[mod.name] = mod
|
|
|
|
if (this.view) this.view.querySelector(`#${name} button`).innerHTML = 'deactivate' |
|
|
|
|
|
|
|
return instance |
|
|
|
return instance |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|