1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-04 08:34:07 +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.waitingForReady = [];
this.areModulesLoaded = false;
this.isAppReady = false;
}
isDisabled(plugin) {
@ -99,7 +100,7 @@ export default function() {
}
onModulesLoaded(namespace) {
if (namespace === "tweetdeck") {
if (namespace === "tweetdeck" && !this.areModulesLoaded) {
window.TDPF_getColumnName = window.TDGF_getColumnName;
window.TDPF_reloadColumns = window.TDGF_reloadColumns;
window.TDPF_prioritizeNewestEvent = window.TDGF_prioritizeNewestEvent;
@ -118,12 +119,20 @@ export default function() {
this.waitingForModules.forEach(plugin => plugin.obj.enabled());
this.waitingForModules = [];
this.areModulesLoaded = true;
if (this.isAppReady) {
this.onReady();
}
}
}
onReady() {
this.waitingForReady.forEach(plugin => plugin.obj.ready());
this.waitingForReady = [];
this.isAppReady = true;
if (this.areModulesLoaded) {
this.waitingForReady.forEach(plugin => plugin.obj.ready());
this.waitingForReady = [];
}
}
};