changeset 07010c9b1425 in www.tryton.org:default
details: https://hg.tryton.org/www.tryton.org?cmd=changeset;node=07010c9b1425
description:
        Manage asynchronous load of map.js

        When map.js is loaded asynchronously, the document may be already ready 
so the
        DOMContentLoaded event is no more raised but we can call the setup 
function
        directly.
diffstat:

 js/map.js |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (17 lines):

diff -r 271165794ec6 -r 07010c9b1425 js/map.js
--- a/js/map.js Thu Jun 25 13:32:27 2020 +0200
+++ b/js/map.js Fri Jul 17 22:44:36 2020 +0200
@@ -1,5 +1,11 @@
-document.addEventListener('DOMContentLoaded', function() {
+if (document.readyState === 'loading') {
+    document.addEventListener('DOMContentLoaded', function() {
+        if (typeof setupMap !== 'undefined') {
+            setupMap();
+        }
+    });
+} else {
     if (typeof setupMap !== 'undefined') {
         setupMap();
     }
-});
+}

Reply via email to