document unload promise resolving correctly with promise shim
authorDarren <darren@darrenwhitlen.com>
Wed, 22 Oct 2014 19:19:52 +0000 (20:19 +0100)
committerDarren <darren@darrenwhitlen.com>
Wed, 22 Oct 2014 19:19:52 +0000 (20:19 +0100)
client/src/index.html.tmpl

index 71c1d00cb3ae15e44a052865350e21e70e067768..a47084c8cfa0b78c4ba80cba69957a66a0ec0b3d 100644 (file)
         }\r
 \r
         onload_promise = new Promise(function (resolve) {\r
+            // Document may already be loaded if we had to load the Promise shim seperately\r
+            if (document.readyState === 'complete') {\r
+                resolve();\r
+                return;\r
+            }\r
+\r
             window.onload = resolve;\r
         });\r
 \r