1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-28 17:34:06 +02:00

Fix the possibility of plugin functions running in wrong order if main module loading gets delayed

This commit is contained in:
chylex 2021-12-23 05:23:02 +01:00
parent 008de87e55
commit ceae748503
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548

View File

@ -27,6 +27,7 @@ export default function() {
this.waitingForModules = []; this.waitingForModules = [];
this.waitingForReady = []; this.waitingForReady = [];
this.areModulesLoaded = false; this.areModulesLoaded = false;
this.isAppReady = false;
} }
isDisabled(plugin) { isDisabled(plugin) {
@ -99,7 +100,7 @@ export default function() {
} }
onModulesLoaded(namespace) { onModulesLoaded(namespace) {
if (namespace === "tweetdeck") { if (namespace === "tweetdeck" && !this.areModulesLoaded) {
window.TDPF_getColumnName = window.TDGF_getColumnName; window.TDPF_getColumnName = window.TDGF_getColumnName;
window.TDPF_reloadColumns = window.TDGF_reloadColumns; window.TDPF_reloadColumns = window.TDGF_reloadColumns;
window.TDPF_prioritizeNewestEvent = window.TDGF_prioritizeNewestEvent; window.TDPF_prioritizeNewestEvent = window.TDGF_prioritizeNewestEvent;
@ -118,12 +119,20 @@ export default function() {
this.waitingForModules.forEach(plugin => plugin.obj.enabled()); this.waitingForModules.forEach(plugin => plugin.obj.enabled());
this.waitingForModules = []; this.waitingForModules = [];
this.areModulesLoaded = true; this.areModulesLoaded = true;
if (this.isAppReady) {
this.onReady();
}
} }
} }
onReady() { onReady() {
this.waitingForReady.forEach(plugin => plugin.obj.ready()); this.isAppReady = true;
this.waitingForReady = [];
if (this.areModulesLoaded) {
this.waitingForReady.forEach(plugin => plugin.obj.ready());
this.waitingForReady = [];
}
} }
}; };