« get me outta code hell

upd8: provide closeLanguageWatchers function - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/upd8.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-09 11:32:03 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-09 11:32:03 -0400
commitd3930822b87e01ae85bbc7e1f3f2598d8f680187 (patch)
tree32f807176ee24f71d56a554d478670711634366f /src/upd8.js
parent7e43883bca8a58b2212288e1fcdf50d1143fd894 (diff)
upd8: provide closeLanguageWatchers function
Diffstat (limited to 'src/upd8.js')
-rwxr-xr-xsrc/upd8.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/upd8.js b/src/upd8.js
index d001c76..5b6b440 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -1539,6 +1539,17 @@ async function main() {
     }
   }
 
+  const closeLanguageWatchers = () => {
+    if (languageReloading) {
+      for (const watcher of [
+        internalDefaultLanguageWatcher,
+        ...customLanguageWatchers,
+      ]) {
+        watcher.close();
+      }
+    }
+  };
+
   const inheritStringsFromInternalLanguage = () => {
     // The custom default language, if set, will be the new one providing fallback
     // strings for other languages. But on its own, it still might not be a complete
@@ -1792,6 +1803,7 @@ async function main() {
       wikiData,
 
       cachebust: '?' + CACHEBUST,
+      closeLanguageWatchers,
       developersComment,
       getSizeOfAdditionalFile,
       getSizeOfImagePath,