]> _ Git - fluidbook-html5.git/commitdiff
wait #7133 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 5 Nov 2024 11:56:56 +0000 (12:56 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 5 Nov 2024 11:56:56 +0000 (12:56 +0100)
js/libs/fluidbook/fluidbook.networkcontrol.js

index 7d33771dc91b904db863d75c86fff7a3dc38b544..1ae2f27a43fd7e86069a1c18e71ff31f768b138d 100644 (file)
@@ -5,6 +5,8 @@ function FluidbookNetworkControl(fluidbook) {
     this.pausePriorityQueue = [];
     this.afterProcessingQueue = [];
     this.processing = true;
+    this.pauseAfterSplash = true;
+    this.pauseAfterSplashDuration = 10000;
     this.init();
 }
 
@@ -16,6 +18,13 @@ FluidbookNetworkControl.prototype = {
                 $this.resume();
             }
         }, 1000);
+
+        $(this.fluidbook).on('fluidbook.splash.hide', function () {
+            setTimeout(function () {
+                $this.pauseAfterSplash = false;
+                $this.pause($this.pauseAfterSplashDuration, true);
+            }, $this.pauseAfterSplashDuration);
+        });
     },
 
     pause: function (during, reset) {
@@ -37,8 +46,18 @@ FluidbookNetworkControl.prototype = {
         return;
     },
 
+    isEnabled: function () {
+        if (this.fluidbook.shortLoading) {
+            return false;
+        }
+        if (this.pauseAfterSplash) {
+            return true;
+        }
+        return !this.fluidbook.settings.priorityToPreload;
+    },
+
     executeWhenNetwork: function (f, highPriority) {
-        if (this.fluidbook.shortLoading || this.fluidbook.settings.priorityToPreload) {
+        if (!this.isEnabled()) {
             f();
             return;
         }