]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7090 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 24 Sep 2024 06:00:26 +0000 (08:00 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 24 Sep 2024 06:00:26 +0000 (08:00 +0200)
resources/scorm/scorm.js

index 296820268fcdf3ed9236897e6396f7f368229465..ae46b32b997120800a10d7b47460124e13aad514 100644 (file)
@@ -48,8 +48,8 @@ CubeSCORM.prototype = {
         }
 
         this.SCORM_INITED = true;
-        if(disable===true){
-            this.SCORM_OK=false;
+        if (disable === true) {
+            this.SCORM_OK = false;
             return false;
         }
         try {
@@ -101,8 +101,14 @@ CubeSCORM.prototype = {
         let $this = this;
         this.SCORM_EVENTS_INITED = true;
 
-        $(window).on('unload', function () {
-            $this.finishScorm();
+        window.addEventListener('pageshow', (event) => {
+            if (event.persisted) {
+                location.reload();
+            }
+        });
+
+        window.addEventListener('pagehide', (event) => {
+            finishScorm();
         });
 
         setInterval(function () {