1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-03 14:34:08 +02:00

Tweak plugin system to not trigger enabled()/disabled() if requiresPageReload is true

This commit is contained in:
chylex 2017-04-01 16:22:23 +02:00
parent 790d1787fd
commit dfd987041a

View File

@ -49,19 +49,26 @@
} }
setState(plugin, enable){ setState(plugin, enable){
let reloading = plugin.obj.$pluginSettings.requiresPageReload;
if (enable && this.isDisabled(plugin)){ if (enable && this.isDisabled(plugin)){
this.disabled.splice(this.disabled.indexOf(plugin.id), 1); if (reloading){
plugin.obj.enabled(); location.reload();
this.runWhenReady(plugin); }
else{
this.disabled.splice(this.disabled.indexOf(plugin.id), 1);
plugin.obj.enabled();
this.runWhenReady(plugin);
}
} }
else if (!enable && !this.isDisabled(plugin)){ else if (!enable && !this.isDisabled(plugin)){
this.disabled.push(plugin.id); if (reloading){
plugin.obj.disabled(); location.reload();
} }
else return; else{
this.disabled.push(plugin.id);
if (plugin.obj.$pluginSettings.requiresPageReload){ plugin.obj.disabled();
window.location.reload(); }
} }
} }