aboutsummaryrefslogtreecommitdiff
path: root/featureClass/featureManager.js
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-09-06 21:40:51 +0800
committerGitHub <noreply@github.com>2022-09-06 21:40:51 +0800
commitdae0a294baba5b92c8d7aecc19d6cc69b2bb7bd9 (patch)
tree400822cf2d435fd0ca086ffecba91df89a974f70 /featureClass/featureManager.js
parent6600e4968e4c2e06003dc2bdd4b05dc7eee767f7 (diff)
parent440138a8c05cb5cfbe28c5e77387e049b1db7108 (diff)
downloadSoopyV2-dae0a294baba5b92c8d7aecc19d6cc69b2bb7bd9.tar.gz
SoopyV2-dae0a294baba5b92c8d7aecc19d6cc69b2bb7bd9.tar.bz2
SoopyV2-dae0a294baba5b92c8d7aecc19d6cc69b2bb7bd9.zip
Merge pull request #59 from Soopyboo32/master
pull master
Diffstat (limited to 'featureClass/featureManager.js')
-rw-r--r--featureClass/featureManager.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js
index 75ffa48..4aae70f 100644
--- a/featureClass/featureManager.js
+++ b/featureClass/featureManager.js
@@ -748,18 +748,30 @@ class FeatureManager {
loadSoopy() {
ChatLib.chat(this.messagePrefix + "Loading SoopyV2...")
+ let startLoading = Date.now()
this.loadFeatureMetas()
this.loadFeatureSettings()
+ let loadedFeatures = new Map()
+
Object.keys(this.featureMetas).forEach((feature) => {
if (this.featureSettingsData[feature] && this.featureSettingsData[feature].enabled) {
- this.loadFeature(feature)
+ loadedFeatures.set(feature, false)
+ new Thread(() => {
+ this.loadFeature(feature)
+ loadedFeatures.set(feature, true)
+ }).start()
}
})
+ while ([...loadedFeatures.values()].some(a => !a)) {
+ Thread.sleep(100)
+ }
+
this.finishedLoading = true
ChatLib.chat(this.messagePrefix + "SoopyV2 Loaded!")
+ logger.logMessage("SoopyV2 took " + ((Date.now() - startLoading) / 1000).toFixed(2) + "s to load", 3)
}
loadFeature(feature) { //run in seperate thread so onenable can do network requests